[Sie-announce] SIEコード [1975] CSS2Propertiesの処理にバグがあったため、css . jsからsvg . jsへ処理コードを移した

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 8月 14日 (土) 20:26:44 JST


Revision: 1975
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1975
Author:   dhrname
Date:     2010-08-14 20:26:44 +0900 (Sat, 14 Aug 2010)

Log Message:
-----------
CSS2Propertiesの処理にバグがあったため、css.jsからsvg.jsへ処理コードを移した

Modified Paths:
--------------
    branches/06x/061/org/w3c/dom/css.js
    branches/06x/061/org/w3c/dom/svg.js

Modified: branches/06x/061/org/w3c/dom/css.js
===================================================================
--- branches/06x/061/org/w3c/dom/css.js	2010-08-06 11:47:19 UTC (rev 1974)
+++ branches/06x/061/org/w3c/dom/css.js	2010-08-14 11:26:44 UTC (rev 1975)
@@ -613,31 +613,6 @@
   kerning : "auto",
   textAnchor : "start"
 };
-/*以下は、getComputedStyleメソッドで使うために、CSS2Propertiesの_listプロパティに、
- *CSSprimitiveValueのリストを収納している。なお、その際に、writingModeなどはwriting-modeに変更している
- */
-(function(){
-  var s = [];
-  for (var i in CSS2Properties) {
-    if(CSS2Properties.hasOwnProperty(i)) {
-      var n = s[s.length] = new CSSPrimitiveValue();
-      var t = i.replace(/([A-Z])/, "-");
-      if (!!RegExp.$1) {
-        var u = "-" +RegExp.$1.toLowerCase();
-      } else {
-        var u = "-";
-      }
-      t = t.replace(/\-/, u);
-      n.cssText += t;
-      n.cssText += ":";
-      n.cssText += CSS2Properties[i];
-      n = p = m = i = t = u = null;
-    }
-  }
-  s._opacity = 1;
-  s._fontSize = 12;
-  CSS2Properties._list = s;
-})();
 
 function CSSStyleSheet() {
 /*CSSRule*/      this.ownerRule = null;

Modified: branches/06x/061/org/w3c/dom/svg.js
===================================================================
--- branches/06x/061/org/w3c/dom/svg.js	2010-08-06 11:47:19 UTC (rev 1974)
+++ branches/06x/061/org/w3c/dom/svg.js	2010-08-14 11:26:44 UTC (rev 1975)
@@ -201,7 +201,8 @@
       style.cssText = sc;
       if (sc !== "") {
         //style属性値の解析
-        sc = sc.replace(/\:\s+/g, ":")
+        sc = sc.replace(/^[^a-z\-]+/, "")
+               .replace(/\:\s+/g, ":")
                .replace(/\s*;[^a-z\-]*/g, ";");
         var a = sc.split(";");
         for (var i=0, ali=a.length;i<ali;++i) {
@@ -4413,6 +4414,30 @@
   view:            SVGViewElement,
   vkern:           SVGVKernElement
 };
+
+/*以下は、getComputedStyleメソッドで使うために、CSS2Propertiesの_listプロパティに、
+ *CSSprimitiveValueのリストを収納している。なお、その際に、writingModeなどはwriting-modeに変更している
+ */
+(function(){
+  var s = new CSSStyleDeclaration();
+  for (var i in CSS2Properties) {
+    if(CSS2Properties.hasOwnProperty(i)) {
+      var t = i.replace(/([A-Z])/, "-");
+      if (!!RegExp.$1) {
+        var u = "-" +RegExp.$1.toLowerCase();
+      } else {
+        var u = "-";
+      }
+      t = t.replace(/\-/, u);
+      s.setProperty(t, CSS2Properties[i]);
+      p = m = i = t = u = null;
+    }
+  }
+  s._list._opacity = 1;
+  s._list._fontSize = 12;
+  CSS2Properties._list = s._list;
+})();
+
 NAIBU.addEvent = function(evt,lis){
   if (window.addEventListener) {
     window.addEventListener(evt, lis, false);




Sie-announce メーリングリストの案内
Back to archive index