From dc291028de4d958a06325c88ba26a3fc3beb4863 Mon Sep 17 00:00:00 2001 From: dhrname Date: Sun, 1 Mar 2015 21:22:54 +0900 Subject: [PATCH] Lighten the call method of the object --- org/w3c/dom/smil.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 088f867..f473938 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -474,14 +474,13 @@ base("$from").of( { if (!this.string || !this.numList || !this.strList) { return this.numList; } - var isFirstNum = /^[\-\+]?[\d\.]/.test(this.string), - /*文字列がa1のように、数値で終わるかどうか。終わったら真*/ - isLastNum = /\d$/.test(this.string), - isNormal = (this.numList.length < this.strList.length); - if (isFirstNum && !isNormal) { + var isNormal = (this.numList.length < this.strList.length); + if (/^[\-\+]?[\d\.]/.test(this.string) && !isNormal) { + /*文字列が1aのように、数値で始まる場合*/ this.strList.unshift(""); } - if (isLastNum && !isNormal) { + if (/\d$/.test(this.string) && !isNormal) { + /*文字列がa1のように、数値で終わる場合*/ this.strList.push(""); } return this.numList; @@ -491,7 +490,7 @@ base("$from").of( { .mix( { /*advance メソッド * アニメーションの進行具合を示す進捗率 t (0 <= t <= 1)をもとに、現在の呈示値を算出するためのもの - * callメソッドで前もって呼び出されていることが前提となる*/ + * callメソッドが前もって呼び出されていることが前提となる*/ advance: function(t) { if ( (t < 0) || (1 < t)) { throw new Error("An Invalid Number Error"); -- 2.11.0