OSDN Git Service

1, SVGAnimationElementのtimeing関数に入れる引数を修正
authordhrname <dhrname@users.sourceforge.jp>
Sun, 8 Jan 2012 11:08:53 +0000 (20:08 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sun, 8 Jan 2012 11:08:53 +0000 (20:08 +0900)
2, _getOffsetメソッドの引数に、数値が含まれていない場合の処理を追加

org/w3c/dom/svg.js

index 13c2b83..2966f2a 100644 (file)
@@ -5225,8 +5225,7 @@ function SVGAnimationElement(es) {
         return this;
       }
       /*begin属性とend属性を処理する*/
-      var _begin =  tar._begin ? tar._getOffset(tar._begin) : 0,
-          that = tar,
+      var that = tar,
           timing = function(val, name, offset) {
         /*timing関数は時間のタイミングをidとeventと、clock-value(offset)に分割して処理していく
          *まず、idを検出するためのsearcIdローカル関数を作る
@@ -5290,10 +5289,12 @@ function SVGAnimationElement(es) {
         }
         val = searchId = id = void 0;
       };
-      timing((tar._begin || "0ms"), "beginElementAt", _begin);
-      if (tar._end) {
-        timing(tar._end, "endElementAt", tar._getOffset(tar._end));
+      if (tar._begin) {
+        timing(tar._begin, "beginElementAt", tar._getOffset(tar._begin));
+      } else {
+        tar.beginElement();
       }
+      tar._end && timing(tar._end, "endElementAt", tar._getOffset(tar._end));
       that = void 0;
       if (tar.hasAttributeNS("http://www.w3.org/1999/xlink", "xlink:href")) {
         tar.targetElement = tar.ownerDocument.getElementById(tar.getAttributeNS("http://www.w3.org/1999/xlink", "xlink:href").substring(1))
@@ -5346,7 +5347,7 @@ SVGAnimationElement.prototype._unit = {
  ** Note that when the simple duration is "indefinite", some simple use cases can yield surprising results. See the related example #4 in Appendix B.
  */
 SVGAnimationElement.prototype._getOffset = function(/*string*/ t) {
-  var n = parseFloat(t.match(this._timeRegExp)),
+  var n = parseFloat((t.match(this._timeRegExp) || "0")),
       offset = 0;
   if (isFinite(n) && RegExp.$1) {
     var offset = n * this._unit[RegExp.$1]