svnno****@sourc*****
svnno****@sourc*****
2010年 4月 4日 (日) 00:16:38 JST
Revision: 1775
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1775
Author: dhrname
Date: 2010-04-04 00:16:38 +0900 (Sun, 04 Apr 2010)
Log Message:
-----------
getPropertyCSSValueメソッドの修正
Modified Paths:
--------------
branches/ufltima/dom/css.js
Modified: branches/ufltima/dom/css.js
===================================================================
--- branches/ufltima/dom/css.js 2010-04-03 15:00:53 UTC (rev 1774)
+++ branches/ufltima/dom/css.js 2010-04-03 15:16:38 UTC (rev 1775)
@@ -209,10 +209,16 @@
*/
/*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) {
propertyName += ":";
+ if (propertyName === ":") { //どんなデータ型でも、文字列に変換する機能をJavaScriptが持つことに注意
+ return null;
+ }
for (var i=0,tli=this._list.length;i<tli;++i) {
var ti = this._list[i], tc = ti.cssText;
- if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
- if (propertyName === "fill:" || propertyName === "stroke:") { //fill、strokeプロパティは別途、SVGPaintで処理
+ if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
+ if ((propertyName === "fill:") || (propertyName === "stroke:")) {
+ /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
+ *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
+ */
ti = new SVGPaint();
ti.cssText = tc;
var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null;
@@ -223,7 +229,7 @@
color = this.getPropertyValue("color");
} else {
var _urlreg = /url\(#([^)]+)/;
- if (_urlreg.test(tc)) { //fill属性の値がurl(#id)ならば
+ if (_urlreg.test(tc)) { //fill属性の値がurl(#id)ならば
paintType = SVGPaint.SVG_PAINTTYPE_URI;
uri = RegExp.$1;
} else {
@@ -232,6 +238,7 @@
}
}
ti.setPaint(paintType, uri, color, null);
+ this._list[i] = ti;
}
return ti;
}