svnno****@sourc*****
svnno****@sourc*****
2011年 4月 2日 (土) 23:42:44 JST
Revision: 2551
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2551
Author: dhrname
Date: 2011-04-02 23:42:44 +0900 (Sat, 02 Apr 2011)
Log Message:
-----------
getFloatValueメソッドの正規表現リテラルをあらかじめ作ることで最適化
Modified Paths:
--------------
branches/07x/074/org/w3c/dom/css.js
Modified: branches/07x/074/org/w3c/dom/css.js
===================================================================
--- branches/07x/074/org/w3c/dom/css.js 2011-04-02 14:35:45 UTC (rev 2550)
+++ branches/07x/074/org/w3c/dom/css.js 2011-04-02 14:42:44 UTC (rev 2551)
@@ -402,13 +402,15 @@
/*getFloatValueメソッド
*別の単位に変換可能。
*/
+CSSPrimitiveValue.prototype._regD = /\D+$/;
+CSSPrimitiveValue.prototype._regd = /[\d\.]+/;
/*float*/ CSSPrimitiveValue.prototype.getFloatValue = function(/*short*/ unitType) {
if ((/*CSSPrimitiveValue.CSS_UNKNOWN*/ 0 >= unitType) && (unitType >= /*CSSPrimitiveValue.CSS_STRING*/ 19)) { //浮動小数点数単位型をサポートしないCSS単位である場合
throw new DOMException(DOMException.INVALID_ACCESS_ERR);
}
- var n = this.cssText.match(/\D+$/),
+ var n = this.cssText.match(this._regD),
type = 0,
- s = +(this.cssText.match(/[\d\.]+/));
+ s = +(this.cssText.match(this._regd));
s = isNaN(s) ? 0 : s;
if (!!n) {
n = n[0];