svnno****@sourc*****
svnno****@sourc*****
2010年 2月 12日 (金) 20:19:32 JST
Revision: 1658
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1658
Author: dhrname
Date: 2010-02-12 20:19:32 +0900 (Fri, 12 Feb 2010)
Log Message:
-----------
CSSStyleDeclarationクラスを編集
Modified Paths:
--------------
branches/ufltima/dom/css.js
Modified: branches/ufltima/dom/css.js
===================================================================
--- branches/ufltima/dom/css.js 2010-02-11 13:45:14 UTC (rev 1657)
+++ branches/ufltima/dom/css.js 2010-02-12 11:19:32 UTC (rev 1658)
@@ -190,19 +190,26 @@
return this;
};
CSSStyleDeclaration.prototype = {
+ /*getPropertyValueメソッド
+ *CSSの値を返す。この値は継承ではなくて、明示的に表記されているもの
+ */
/*string*/ getPropertyValue : function( /*string*/ propertyName) {
var tg = this.getPropertyCSSValue(propertyName);
if (tg) { //見つかった場合
- //_valueプロパティは本来、cssTextで代用されるべき
- return (tg._value);
+ var pn = new RegExp(propertyName+":\s*");
+ return (tg.cssText.replace(pn, ""));
} else {
return "";
}
},
+ /*getPropertyCSSValueメソッド
+ *CSSValueオブジェクトを返す。このメソッドは判別に用いているので、削除不可。
+ */
/*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) {
+ propertyName += ":";
for (var i=0,tli=this._list.length;i<tli;++i) {
var ti = this._list[i];
- if (ti._propertyName === propertyName) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
+ if (ti.cssText.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
return ti;
}
}
@@ -225,24 +232,23 @@
/*void*/ setProperty : function( /*string*/ propertyName, /*string*/ value, /*string*/ priority) {
var tg = this.getPropertyCSSValue(propertyName);
if (tg) { //見つかった場合
- /*_priorityや_propertyName、_valueといったプロパティは、本当ならば、
- *cssTextプロパティに収納されるべきである。get関連メソッドで解析するのが大変なので、3つのプロパティに分けておいた
- */
tg._priority = priority;
- tg._propertyName = propertyName;
- tg._value = value;
+ tg.cssText += propertyName;
+ tg.cssText += ":"
+ tg.cssText += value;
} else {
var ti = new CSSPrimitiveValue();
tg._priority = priority;
- tg._propertyName = propertyName;
- tg._value = value;
+ tg.cssText += propertyName;
+ tg.cssText += ":"
+ tg.cssText += value;
ti._num = this._list.length;
this._list[ti._num] = ti;
++this.length;
}
},
/*string*/ item : function( /*long*/ index) {
- return (this._list[index]._propertyName);
+ return (this._list[index].cssText.substring(0, this._list[index].cssText.indexOf(":")));
}
};