OSDN Git Service

Add a defaultValue property to the object
authordhrname <dhrname@users.sourceforge.jp>
Wed, 13 May 2015 14:20:04 +0000 (23:20 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 13 May 2015 14:20:04 +0000 (23:20 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 26c6213..e18a42c 100644 (file)
@@ -828,6 +828,9 @@ base("$calcMode").up("$attribute").mix( {
   \r
   /*attributeName属性の値*/\r
   attrName: "",\r
+  \r
+  /*指定された属性の規定値*/\r
+  defaultValue: "",\r
 \r
   init: function(ele) {\r
     this.push(ele);\r
@@ -835,6 +838,10 @@ base("$calcMode").up("$attribute").mix( {
       this.to = ele.getAttributeNS(null, "to") || "";\r
       this.attrName = ele.getAttributeNS(null, "attributeName") || "";\r
     }\r
+    if (this.element) {\r
+      this.defaultValue = this.element.getAttributeNS(null, this.attrName)\r
+         || this.element.ownerDocument.defaultView.getComputedStyle(this.element, "").getPropertyValue(this.attrName);\r
+    }\r
   }\r
 });\r
 \r
index 1a98121..da09d37 100644 (file)
@@ -3585,21 +3585,30 @@ describe("SMIL Animation Spec", function() {
       it("should be this for the value  (limit value analysis)", function() {\r
         expect($set.to).toBe("");\r
         expect($set.attrName).toBe("");\r
+        expect($set.defaultValue).toBe("");\r
         $set.init();\r
         $set.init(ele);\r
         expect($set.to).toBe("");\r
         expect($set.attrName).toBe("");\r
-        \r
+      \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
         ele.setAttributeNS(null, "to", "t1");\r
         $set.init(ele);\r
         expect($set.to).toBe("t1");\r
+        expect($set.attrName).toBe("");\r
+        expect($set.defaultValue).toBe("");\r
 \r
         ele.setAttributeNS(null, "attributeName", "tt1");\r
         $set.init(ele);\r
+        expect($set.to).toBe("t1");\r
         expect($set.attrName).toBe("tt1");\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
+        expect($set.defaultValue).toBe("");\r
+\r
+        ele.parentNode.setAttributeNS(null, "tt1", "undef");\r
+        $set.init(ele);\r
+        expect($set.defaultValue).toBe("undef");\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion on a spline mode )", function() {\r