svnno****@sourc*****
svnno****@sourc*****
2011年 5月 8日 (日) 20:42:59 JST
Revision: 2668 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2668 Author: dhrname Date: 2011-05-08 20:42:59 +0900 (Sun, 08 May 2011) Log Message: ----------- Modified Paths: -------------- branches/07x/077/org/w3c/dom/css.js Modified: branches/07x/077/org/w3c/dom/css.js =================================================================== --- branches/07x/077/org/w3c/dom/css.js 2011-05-08 11:42:46 UTC (rev 2667) +++ branches/07x/077/org/w3c/dom/css.js 2011-05-08 11:42:59 UTC (rev 2668) @@ -669,9 +669,23 @@ CSSStyleSheet.prototype = new StyleSheet(); CSSStyleSheet.constructor = StyleSheet; /*long*/ CSSStyleSheet.prototype.insertRule = function( /*string*/ rule, /*long*/ index) { - var s = new CSSStyleRule(); + var s = new CSSStyleRule(), style = s.style, a, sc = rule.match(/\{[\s\S]+\}/), m; s.parentStyleSheet = this; - s.cssText = rule; + style.cssText = rule; + //style値の解析; + sc = sc.replace(/^[^a-z\-]+/, "") + .replace(/\:\s+/g, ":") + .replace(/\s*;[^a-z\-]*/g, ";"); + a = sc.split(";"); + for (var i=0, ali=a.length;i<ali;++i) { + ai = a[i], + m = ai.split(":"); + if (ai !== "") { + style.setProperty(m[0], m[1]); + } + ai = m = null; + } + a = sc = style = null; this.cssRules.splice(index,s,1); }; /*void*/ CSSStyleSheet.prototype.deleteRule = function(/*long*/ index) {