svnno****@sourc*****
svnno****@sourc*****
2010年 3月 6日 (土) 20:08:24 JST
Revision: 1702
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1702
Author: dhrname
Date: 2010-03-06 20:08:24 +0900 (Sat, 06 Mar 2010)
Log Message:
-----------
style属性解析の修正
Modified Paths:
--------------
branches/ufltima/dom/svg.js
Modified: branches/ufltima/dom/svg.js
===================================================================
--- branches/ufltima/dom/svg.js 2010-03-06 11:07:55 UTC (rev 1701)
+++ branches/ufltima/dom/svg.js 2010-03-06 11:08:24 UTC (rev 1702)
@@ -151,6 +151,21 @@
*TransformListはtransform属性を行列で表現したあとのリスト構造
*/
/*readonly attribute SVGAnimatedTransformList*/ this.transform = new SVGAnimatedTransformList();
+ //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする
+ this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
+ var style = evt.target.style, sc = style.cssText;
+ if (!!!sc._rewrite) {
+ //style属性値の解析
+ sc = sc.replace(/\:\s+/g, ":")
+ .replace(/\s*;[^a-z\-]*/g, ";");
+ var a = sc.split(";");
+ for (var i=0, ali=a.length;i<ali;++i) {
+ var ai = a[i], m = ai.split(":");
+ style.setProperty(m[0], m[1]);
+ }
+ style.cssText._rewrite = 1;
+ }
+ }, false)
return this;
};
SVGElement.constructor = Element;
@@ -580,26 +595,6 @@
this._runtimeStyle = new CSSStyleDeclaration(); //getOverrideStyleメソッドで利用する
this._attributeStyle = new CSSStyleDeclaration(); //プレゼンテーション属性の値を格納する
//styleのcssTextプロパティを解析するリスナーを登録しておく
- this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
- var style = evt.target.style, n = false;
- for (var i=0, sli=style.length;i<sli;++i) {
- var s = style.getPropertyCSSValue(style.item(i));
- if (!!!s.cssText._rewrite) {
- n = true;
- s.cssText._rewrite = 1;
- break;
- }
- }
- if (n) { //CSSValueのcssTextが書き換えられていれば
- style.cssText = "";
- for (var i=0, sli=style.length;i<sli;++i) {
- var s = style.getPropertyCSSValue(style.item(i));
- style.cssText += s.cssText;
- }
- }
- if (!!!style.cssText._rewrite) {
- }
- }, false)
};
/*getPresentationAttributeメソッド
*プレゼンテーション属性の値をCSSValueとして得る。これはCSSのスタイルの設定値を定めるときや、内部の動的処理に役立つ
@@ -1001,7 +996,7 @@
return s;
};
/*SVGLength*/ SVGSVGElement.prototype.createSVGLength = function(){
- var s = new SVGLength(0);
+ var s = new SVGLength();
return s;
};
/*SVGPoint*/ SVGSVGElement.prototype.createSVGPoint = function(){