OLD | NEW |
1 function splitSelector(selector) | 1 function splitSelector(selector) |
2 { | 2 { |
3 if (selector.indexOf(",") == -1) | 3 if (selector.indexOf(",") == -1) |
4 return [selector]; | 4 return [selector]; |
5 | 5 |
6 var selectors = []; | 6 var selectors = []; |
7 var start = 0; | 7 var start = 0; |
8 var level = 0; | 8 var level = 0; |
9 var sep = ""; | 9 var sep = ""; |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 findSelectors: function(stylesheet, selectors) | 59 findSelectors: function(stylesheet, selectors) |
60 { | 60 { |
61 var rules = stylesheet.cssRules; | 61 var rules = stylesheet.cssRules; |
62 if (!rules) | 62 if (!rules) |
63 return; | 63 return; |
64 | 64 |
65 for (var i = 0; i < rules.length; i++) | 65 for (var i = 0; i < rules.length; i++) |
66 { | 66 { |
67 var rule = rules[i]; | 67 var rule = rules[i]; |
68 if (rule.type != this.window.CSSRule.STYLE_RULE) | 68 if (rule.type != rule.STYLE_RULE) |
69 continue; | 69 continue; |
70 | 70 |
71 var style = this.stringifyStyle(rule.style); | 71 var style = this.stringifyStyle(rule.style); |
72 for (var j = 0; j < this.patterns.length; j++) | 72 for (var j = 0; j < this.patterns.length; j++) |
73 { | 73 { |
74 var pattern = this.patterns[j]; | 74 var pattern = this.patterns[j]; |
75 var regexp = pattern.regexp; | 75 var regexp = pattern.regexp; |
76 | 76 |
77 if (typeof regexp == "string") | 77 if (typeof regexp == "string") |
78 regexp = pattern.regexp = new RegExp(regexp); | 78 regexp = pattern.regexp = new RegExp(regexp); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 apply: function() | 120 apply: function() |
121 { | 121 { |
122 if (this.patterns.length > 0) | 122 if (this.patterns.length > 0) |
123 { | 123 { |
124 var document = this.window.document; | 124 var document = this.window.document; |
125 this.addSelectors(document.styleSheets); | 125 this.addSelectors(document.styleSheets); |
126 document.addEventListener("load", this.onLoad.bind(this), true); | 126 document.addEventListener("load", this.onLoad.bind(this), true); |
127 } | 127 } |
128 } | 128 } |
129 }; | 129 }; |
OLD | NEW |