OSDN Git Service

Add an isCSS property to the object
authordhrname <dhrname@users.sourceforge.jp>
Tue, 12 Apr 2016 14:10:03 +0000 (23:10 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 12 Apr 2016 14:10:03 +0000 (23:10 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 12e8d75..c196d2d 100644 (file)
@@ -774,6 +774,9 @@ base("$calcMode").up("$attribute").mix( {
   /*もともと属性がターゲットの要素につけられていたかどうか*/\r
   isDefault: false,\r
   \r
+  /*attributeType属性がCSSだったときや、autoで属性名がCSSプロパティ名だったときには、true*/\r
+  isCSS: false,\r
+  \r
   /*指定した要素の属性値を取得するメソッド*/\r
   getAttr: function(/*string*/ name, def) {\r
     var nameSpace = null;\r
@@ -865,6 +868,17 @@ base("$calcMode").up("$attribute").mix( {
       */\r
       return null;\r
     }\r
+    /*属性タイプの設定*/\r
+    var attrType = this.getAttr("attributeType", "auto");\r
+    if (attrType === "CSS") {\r
+      this.isCSS = true;\r
+    } else if ((attrType === "auto") && this.element) {\r
+      if ( this.element.ownerDocument.defaultView.getComputedStyle(this.element, "")\r
+               .getPropertyValue(this.attrName) ) {\r
+                 this.isCSS = true;\r
+      }\r
+    }\r
+    /*属性値の設定*/\r
     this.attrName = this.getAttr("attributeName", "");\r
     if (this.attrName.indexOf("xlink") > -1) {\r
       this.attrNameSpace = "http://www.w3.org/1999/xlink";\r
index 5e50cb1..d101d80 100644 (file)
@@ -1594,6 +1594,7 @@ describe("SMIL Animation Spec", function() {
         expect(attr.element).toBeNull();\r
         expect(attr.push()).toBeNull();\r
         expect(attr.element).toBeNull();\r
+        expect(attr.isCSS).toBeFalsy();\r
         expect(base("$frame").timelines.length).toBe(0);\r
         \r
         expect(attr.push(s)).toBeNull();\r
@@ -1654,6 +1655,12 @@ describe("SMIL Animation Spec", function() {
         s.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#p34");\r
         attr.push(s);\r
         expect(attr.element).toBe(p3);\r
+        \r
+        /*attributeType属性のサポート*/\r
+        s.setAttributeNS(null, "attributeType", "CSS");\r
+        s.setAttributeNS(null, "values", "a;b;c");\r
+        attr.push(s);\r
+        expect(attr.isCSS).toBeTruthy();\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion on a spline mode )", function() {\r
@@ -1728,6 +1735,13 @@ describe("SMIL Animation Spec", function() {
         expect(attr.removeAttribute()).toBeUndefined();\r
         expect(p4.hasAttributeNS(null, "display")).toBeFalsy();\r
         expect(p4.style.getPropertyValue("display")).toBe("none");\r
+        \r
+        /*attributeType属性のサポート*/\r
+        s.setAttributeNS(null, "values", "a;b;c");\r
+        s.setAttributeNS(null, "attributeName", "display");\r
+        attr.isCSS = false;\r
+        attr.push(s);\r
+        expect(attr.isCSS).toBeTruthy();\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion )", function() {\r