OSDN Git Service

Modify the additive attribute's problem
authordhrname <dhrname@users.sourceforge.jp>
Wed, 2 Dec 2015 13:25:13 +0000 (22:25 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 2 Dec 2015 13:25:13 +0000 (22:25 +0900)
org/w3c/dom/smil.js

index d670973..a09f39e 100644 (file)
@@ -534,7 +534,11 @@ base("$from").of( {
   \r
   /*$toオブジェクトにこのオブジェクトを適用させる関数*/\r
   call: function() {\r
-    if (this.numList.length) {\r
+    if (this.numList.length\r
+          && (this.additive[0] === 0)\r
+          && (this.accumulate[0] === 0)\r
+          ) {\r
+      /*配列の項目がundefinedだと困るので、配列を初期化する*/\r
       var additive = [],\r
           accumulate = [];\r
       for (var i=0;i<this.numList.length;++i) {\r
@@ -633,9 +637,7 @@ base("$from").of( {
         }\r
         var from = this.$from.up();\r
         from.string = str;\r
-        var s = from.call();\r
-        this.additive = s;\r
-        return s;\r
+        return ( this.additive = from.call() );\r
       },\r
      \r
      /*setAccumulate メソッド\r
@@ -645,11 +647,9 @@ base("$from").of( {
         if (!num || isNaN(num)) {\r
           return 0;\r
         }\r
-        var s = this.numList.map( function(d) {\r
+        return ( this.accumulate = this.numList.map( function(d) {\r
           return d * num;\r
-        } );\r
-        this.accumulate = s;\r
-        return s;\r
+        } ) );\r
       }\r
   } )\r
   /*fromプロパティの初期化*/\r