| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 *getElements(prefix, subtree, styles) | 219 *getElements(prefix, subtree, styles) |
| 220 { | 220 { |
| 221 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? | 221 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? |
| 222 prefix + "*" : prefix; | 222 prefix + "*" : prefix; |
| 223 let elements = subtree.querySelectorAll(actualPrefix); | 223 let elements = subtree.querySelectorAll(actualPrefix); |
| 224 for (let element of elements) | 224 for (let element of elements) |
| 225 { | 225 { |
| 226 let iter = evaluate(this._innerSelectors, 0, "", element, styles); | 226 let iter = evaluate(this._innerSelectors, 0, "", element, styles); |
| 227 for (let selector of iter) | 227 for (let selector of iter) |
| 228 { | 228 { |
| 229 // :scope isn't supported on Edge. It still is not standard. | |
|
Wladimir Palant
2017/08/16 08:17:15
What do you mean by "not standard"? It's part of t
hub
2017/08/16 15:30:45
Done.
| |
| 230 if (relativeSelectorRegexp.test(selector)) | 229 if (relativeSelectorRegexp.test(selector)) |
| 231 selector = ":scope" + selector; | 230 selector = ":scope" + selector; |
| 232 try | 231 try |
| 233 { | 232 { |
| 234 if (element.querySelector(selector)) | 233 if (element.querySelector(selector)) |
| 235 yield element; | 234 yield element; |
| 236 } | 235 } |
| 237 catch (e) | 236 catch (e) |
| 238 { | 237 { |
| 238 // :scope isn't supported on Edge, ignore error caused by it. | |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 function ContainsSelector(textContent) | 245 function ContainsSelector(textContent) |
| 246 { | 246 { |
| 247 this._text = textContent; | 247 this._text = textContent; |
| 248 } | 248 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 | 517 |
| 518 if (this.patterns.length > 0) | 518 if (this.patterns.length > 0) |
| 519 { | 519 { |
| 520 let {document} = this.window; | 520 let {document} = this.window; |
| 521 this.addSelectors(); | 521 this.addSelectors(); |
| 522 document.addEventListener("load", this.onLoad.bind(this), true); | 522 document.addEventListener("load", this.onLoad.bind(this), true); |
| 523 } | 523 } |
| 524 }); | 524 }); |
| 525 } | 525 } |
| 526 }; | 526 }; |
| LEFT | RIGHT |