svnno****@sourc*****
svnno****@sourc*****
2011年 10月 29日 (土) 21:44:21 JST
Revision: 3044 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=3044 Author: dhrname Date: 2011-10-29 21:44:21 +0900 (Sat, 29 Oct 2011) Log Message: ----------- getComputedStyleメソッドとgetOverrideStyleメソッドのクロージャの指定が間違っていたので修正 Modified Paths: -------------- branches/08x/088/org/w3c/dom/css.js Modified: branches/08x/088/org/w3c/dom/css.js =================================================================== --- branches/08x/088/org/w3c/dom/css.js 2011-10-29 12:22:51 UTC (rev 3043) +++ branches/08x/088/org/w3c/dom/css.js 2011-10-29 12:44:21 UTC (rev 3044) @@ -745,37 +745,38 @@ ct, p; ct = null p = {length:0, _opacity:1, _fontSize:12}; - var td = this._defaultCSS; //デフォルト値の設定 //クロージャを利用して、カスケーディングを実現する - s.getPropertyCSSValue = function( /*string*/ propertyName) { - var el = elt, - css = null; - while (el && (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0))) { - if (el._runtimeStyle && el._runtimeStyle[propertyName]) { - css = el._runtimeStyle.getPropertyCSSValue(propertyName); - } else if (el.style && el.style[propertyName]) { - css = el.style.getPropertyCSSValue(propertyName); - } else if (el._rules) { - //スタイルシートのルールを探す - for (var i=0,eli=el._rules.length;i<eli;++i) { - el._rules[i].style[propertyName] && (css = el._rules[i].style.getPropertyCSSValue(propertyName)); + s.getPropertyCSSValue = (function(elt, td){ + return function( /*string*/ propertyName) { + var el = elt, + css = null; + while (el && (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0))) { + if (el._runtimeStyle && el._runtimeStyle[propertyName]) { + css = el._runtimeStyle.getPropertyCSSValue(propertyName); + } else if (el.style && el.style[propertyName]) { + css = el.style.getPropertyCSSValue(propertyName); + } else if (el._rules) { + //スタイルシートのルールを探す + for (var i=0,eli=el._rules.length;i<eli;++i) { + el._rules[i].style[propertyName] && (css = el._rules[i].style.getPropertyCSSValue(propertyName)); + } + } else if (el._attributeStyle && el._attributeStyle[propertyName]) { + //プレゼンテーション属性を探す + css = el._attributeStyle.getPropertyCSSValue(propertyName); } - } else if (el._attributeStyle && el._attributeStyle[propertyName]) { - //プレゼンテーション属性を探す - css = el._attributeStyle.getPropertyCSSValue(propertyName); + el = el.parentNode; } - el = el.parentNode; - } - if (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0)) { - //デフォルト値を探す - td && (css = td[propertyName]); - } - if (css && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) { - css.setRGBColor && css.setRGBColor(s.getPropertyCSSValue("color")); - } - el = void 0; - return css; - }; + if (!css || (css.cssValueType === /*CSSValue.CSS_INHERIT*/ 0)) { + //デフォルト値を探す + td && (css = td[propertyName]); + } + if (css && ((css.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) || (css.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3))) { + css.setRGBColor && css.setRGBColor(s.getPropertyCSSValue("color")); + } + el = void 0; + return css; + }; + })(elt, this._defaultCSS); //_defaultCSSはデフォルト値の設定 if (!!elt.style) { var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity; } else { @@ -800,29 +801,31 @@ var s = new CSSStyleDeclaration(), setProp = s.setProperty; tar._runtimeStyle = s; } - s.setProperty = function(propertyName, value, priority) { - setProp.call(s, propertyName, value, priority); - var tar = elt, el = tar._tar, isFill = isStroke = false; - delete tar._currentStyle; - if ((tar.localName === "g") || (tar.localName === "a")) { - var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*"); - if (sl) { - for (var i=0,sli=sl.length;i<sli;++i) { - var di = sl[i]; - delete di._currentStyle; - NAIBU._setPaint(di, di.getScreenCTM()); - di = void 0; + s.setProperty = (function(setProp, s){ + return function(propertyName, value, priority) { + setProp.call(s, propertyName, value, priority); + var tar = elt, el = tar._tar, isFill = isStroke = false; + delete tar._currentStyle; + if ((tar.localName === "g") || (tar.localName === "a")) { + var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*"); + if (sl) { + for (var i=0,sli=sl.length;i<sli;++i) { + var di = sl[i]; + delete di._currentStyle; + NAIBU._setPaint(di, di.getScreenCTM()); + di = void 0; + } + sl = void 0; } - sl = void 0; + el = null; } - el = null; - } - if (!el) { - return; - } - NAIBU._setPaint(tar, tar.getScreenCTM()); - el = tar = value = void 0; - } + if (!el) { + return; + } + NAIBU._setPaint(tar, tar.getScreenCTM()); + el = tar = value = void 0; + }; + })(setProp, s); return s; }; /*createCSSStyleSheetメソッド