[Sie-announce] SIEコード [2518] CSSStyleDeclarationのvar文を整理した

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 28日 (月) 22:00:24 JST


Revision: 2518
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2518
Author:   dhrname
Date:     2011-03-28 22:00:23 +0900 (Mon, 28 Mar 2011)

Log Message:
-----------
CSSStyleDeclarationのvar文を整理した

Modified Paths:
--------------
    branches/07x/074/org/w3c/dom/css.js

Modified: branches/07x/074/org/w3c/dom/css.js
===================================================================
--- branches/07x/074/org/w3c/dom/css.js	2011-03-26 14:46:05 UTC (rev 2517)
+++ branches/07x/074/org/w3c/dom/css.js	2011-03-28 13:00:23 UTC (rev 2518)
@@ -208,13 +208,15 @@
    *CSSValueオブジェクトを返す。このメソッドは判別に用いているので、削除不可。
    */
 /*CSSValue*/ getPropertyCSSValue : function( /*string*/ propertyName) {
-    var prop = propertyName;
+    var prop = propertyName,
+        ti, tc;
     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;
+      ti = this._list[i];
+      tc = ti.cssText;
       if (tc.indexOf(propertyName) > -1) {  //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 
         ti._empercents = this._list._fontSize;
         tc = prop = propertyName = null;
@@ -253,11 +255,14 @@
    *プロパティを宣言内で、明示的に設定。継承は無視する
    */
 /*void*/     setProperty : function( /*string*/ propertyName, /*string*/ value, /*string*/ priority) {
-    var cssText = "";
+    var cssText = "",
+        tg = null,
+        ti, paintType,
+        uri = null,
+        color = null,
+        fill, stroke;
     if (!!this[propertyName]) {
-      var tg = this.getPropertyCSSValue(propertyName);
-    } else {
-      var tg = null;
+      tg = this.getPropertyCSSValue(propertyName);
     }
     cssText += propertyName;
     cssText += ":";
@@ -265,14 +270,14 @@
     if (tg) {  //見つかった場合
       tg._priority = priority;
       tg.cssText = cssText;
-      var ti = tg;
+      ti = tg;
     } else {
       if ((propertyName === "fill") || (propertyName === "stroke")) {
         /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
          *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
          */
-        var ti = new SVGPaint();
-        var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null;
+        ti = new SVGPaint();
+        paintType = /*SVGPaint.SVG_PAINTTYPE_UNKNOWN*/ 0;
         if (value === "none") {
           paintType = SVGPaint.SVG_PAINTTYPE_NONE;
         } else if (value === "currentColor") {
@@ -291,8 +296,9 @@
         ti.setPaint(paintType, uri, color, null);
         paintType = uri = color = null;
       } else if (propertyName === "color") {
-        var ti = new CSSPrimitiveValue();
-        var fill = this.getPropertyCSSValue("fill"), stroke = this.getPropertyCSSValue("stroke");
+        ti = new CSSPrimitiveValue();
+        fill = this.getPropertyCSSValue("fill");
+        stroke = this.getPropertyCSSValue("stroke");
         if (fill) {
           if (fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
             fill.setPaint(fill.paintType, null, value, null);
@@ -303,7 +309,7 @@
           }
         }
       } else {
-        var ti = new CSSPrimitiveValue();
+        ti = new CSSPrimitiveValue();
       }
       ti._priority = priority;
       ti.cssText = cssText;




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