| Left: | ||
| Right: |
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 { | 121 { |
| 122 var stylesheet = event.target.sheet; | 122 var stylesheet = event.target.sheet; |
| 123 if (stylesheet) | 123 if (stylesheet) |
| 124 this.addSelectors([stylesheet]); | 124 this.addSelectors([stylesheet]); |
| 125 }, | 125 }, |
| 126 | 126 |
| 127 load: function(callback) | 127 load: function(callback) |
| 128 { | 128 { |
| 129 this.getFiltersFunc(function(patterns) | 129 this.getFiltersFunc(function(patterns) |
| 130 { | 130 { |
| 131 this.patterns = patterns; | 131 // We currently don't support any element hiding emulation feature except |
|
kzar
2016/09/25 14:52:06
Shouldn't it be up to the callback to decide which
Felix Dahlke
2016/09/30 10:22:26
Yeah, that's a good point. My thinking was that we
kzar
2016/10/05 11:58:14
How about adding an extra parameter to the CSSProp
Felix Dahlke
2016/11/03 16:14:13
My thinking on this was that we don't have to pass
| |
| 132 // for property selectors, so we remove rules that use other features. | |
| 133 // See https://issues.adblockplus.org/ticket/3143. | |
| 134 this.patterns = []; | |
| 135 for (var i = 0; i < patterns.length; i++) | |
| 136 { | |
| 137 var pattern = patterns[i]; | |
| 138 if (pattern.features.length == 1 && | |
| 139 pattern.features[0] == "PROPERTY_SELECTOR") | |
| 140 this.patterns.push(pattern); | |
| 141 } | |
| 142 | |
| 132 callback(); | 143 callback(); |
| 133 }.bind(this)); | 144 }.bind(this)); |
| 134 }, | 145 }, |
| 135 | 146 |
| 136 apply: function() | 147 apply: function() |
| 137 { | 148 { |
| 138 if (this.patterns.length > 0) | 149 if (this.patterns.length > 0) |
| 139 { | 150 { |
| 140 var document = this.window.document; | 151 var document = this.window.document; |
| 141 this.addSelectors(document.styleSheets); | 152 this.addSelectors(document.styleSheets); |
| 142 document.addEventListener("load", this.onLoad.bind(this), true); | 153 document.addEventListener("load", this.onLoad.bind(this), true); |
| 143 } | 154 } |
| 144 } | 155 } |
| 145 }; | 156 }; |
| OLD | NEW |