| OLD | NEW |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 "use strict"; | 18 "use strict"; |
| 19 | 19 |
| 20 const {textToRegExp, filterToRegExp, splitSelector} = require("../common"); | 20 const {textToRegExp, filterToRegExp, splitSelector, |
| 21 qualifySelector} = require("../common"); |
| 21 const {indexOf} = require("../coreUtils"); | 22 const {indexOf} = require("../coreUtils"); |
| 22 | 23 |
| 23 let MIN_INVOCATION_INTERVAL = 3000; | 24 let MIN_INVOCATION_INTERVAL = 3000; |
| 24 const MAX_SYNCHRONOUS_PROCESSING_TIME = 50; | 25 const MAX_SYNCHRONOUS_PROCESSING_TIME = 50; |
| 25 const abpSelectorRegexp = /:-abp-([\w-]+)\(/i; | 26 const abpSelectorRegexp = /:-abp-([\w-]+)\(/i; |
| 26 | 27 |
| 27 function getCachedPropertyValue(object, name, defaultValueFunc = () => {}) | 28 function getCachedPropertyValue(object, name, defaultValueFunc = () => {}) |
| 28 { | 29 { |
| 29 let value = object[name]; | 30 let value = object[name]; |
| 30 if (typeof value == "undefined") | 31 if (typeof value == "undefined") |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 for (let subSelector of style.subSelectors) | 380 for (let subSelector of style.subSelectors) |
| 380 { | 381 { |
| 381 if (subSelector.startsWith("*") && | 382 if (subSelector.startsWith("*") && |
| 382 !incompletePrefixRegexp.test(prefix)) | 383 !incompletePrefixRegexp.test(prefix)) |
| 383 { | 384 { |
| 384 subSelector = subSelector.substr(1); | 385 subSelector = subSelector.substr(1); |
| 385 } | 386 } |
| 386 let idx = subSelector.lastIndexOf("::"); | 387 let idx = subSelector.lastIndexOf("::"); |
| 387 if (idx != -1) | 388 if (idx != -1) |
| 388 subSelector = subSelector.substr(0, idx); | 389 subSelector = subSelector.substr(0, idx); |
| 389 yield prefix + subSelector; | 390 yield qualifySelector(subSelector, prefix); |
| 390 } | 391 } |
| 391 }, | 392 }, |
| 392 | 393 |
| 393 *getSelectors(prefix, subtree, styles) | 394 *getSelectors(prefix, subtree, styles) |
| 394 { | 395 { |
| 395 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) | 396 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) |
| 396 yield [selector, subtree]; | 397 yield [selector, subtree]; |
| 397 } | 398 } |
| 398 }; | 399 }; |
| 399 | 400 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 characterData: shouldObserveCharacterData(this.patterns), | 836 characterData: shouldObserveCharacterData(this.patterns), |
| 836 subtree: true | 837 subtree: true |
| 837 } | 838 } |
| 838 ); | 839 ); |
| 839 this.document.addEventListener("load", this.onLoad.bind(this), true); | 840 this.document.addEventListener("load", this.onLoad.bind(this), true); |
| 840 } | 841 } |
| 841 } | 842 } |
| 842 }; | 843 }; |
| 843 | 844 |
| 844 exports.ElemHideEmulation = ElemHideEmulation; | 845 exports.ElemHideEmulation = ElemHideEmulation; |
| OLD | NEW |