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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (rule.type != rule.STYLE_RULE) | 88 if (rule.type != rule.STYLE_RULE) |
89 continue; | 89 continue; |
90 | 90 |
91 var style = this.stringifyStyle(rule.style); | 91 var style = this.stringifyStyle(rule.style); |
92 for (var j = 0; j < this.patterns.length; j++) | 92 for (var j = 0; j < this.patterns.length; j++) |
93 { | 93 { |
94 var pattern = this.patterns[j]; | 94 var pattern = this.patterns[j]; |
95 var regexp = pattern.regexp; | 95 var regexp = pattern.regexp; |
96 | 96 |
97 if (typeof regexp == "string") | 97 if (typeof regexp == "string") |
98 regexp = pattern.regexp = new RegExp(regexp); | 98 regexp = pattern.regexp = new RegExp(regexp, "i"); |
99 | 99 |
100 if (regexp.test(style)) | 100 if (regexp.test(style)) |
101 { | 101 { |
102 var subSelectors = splitSelector(rule.selectorText); | 102 var subSelectors = splitSelector(rule.selectorText); |
103 for (var k = 0; k < subSelectors.length; k++) | 103 for (var k = 0; k < subSelectors.length; k++) |
104 selectors.push(pattern.prefix + subSelectors[k] + pattern.suffix); | 104 selectors.push(pattern.prefix + subSelectors[k] + pattern.suffix); |
105 filters[pattern.text] = true; | 105 filters[pattern.text] = true; |
106 } | 106 } |
107 } | 107 } |
108 } | 108 } |
(...skipping 27 matching lines...) Expand all Loading... |
136 apply: function() | 136 apply: function() |
137 { | 137 { |
138 if (this.patterns.length > 0) | 138 if (this.patterns.length > 0) |
139 { | 139 { |
140 var document = this.window.document; | 140 var document = this.window.document; |
141 this.addSelectors(document.styleSheets); | 141 this.addSelectors(document.styleSheets); |
142 document.addEventListener("load", this.onLoad.bind(this), true); | 142 document.addEventListener("load", this.onLoad.bind(this), true); |
143 } | 143 } |
144 } | 144 } |
145 }; | 145 }; |
OLD | NEW |