Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterClasses.js

Issue 29383960: Issue 3143 - Filter elements with :-abp-has() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Updated the filter syntax Created April 10, 2017, 10:03 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -982,17 +982,18 @@
// Note: The ElemHide.prototype.domainSeparator is duplicated here, if that
// changes this must be changed too.
if (domain && /(^|,)~?(,|$)/.test(domain))
return new InvalidFilter(text, "filter_invalid_domain");
if (isException)
return new ElemHideException(text, domain, selector);
- if (selector.indexOf("[-abp-properties=") != -1)
+ if ((selector.indexOf("[-abp-properties=") != -1) ||
+ (selector.indexOf("[-abp-selector=") != -1))
{
// Element hiding emulation filters are inefficient so we need to make sure
// that they're only applied if they specify active domains
if (!/,[^~][^,.]*\.[^,]/.test("," + domain))
return new InvalidFilter(text, "filter_elemhideemulation_nodomain");
return new ElemHideEmulationFilter(text, domain, selector);
}
@@ -1042,14 +1043,18 @@
* @param {string} domains see ElemHideBase()
* @param {string} selector see ElemHideBase()
* @constructor
* @augments ElemHideBase
*/
function ElemHideEmulationFilter(text, domains, selector)
{
ElemHideBase.call(this, text, domains, selector);
+ this.cssPropFilter = (selector.indexOf("[-abp-properties=") != -1);
+ this.abpSelectorFilter = (selector.indexOf("[-abp-selector=") != -1);
Felix Dahlke 2017/04/10 10:55:12 When I first renamed CSS property filters to eleme
hub 2017/04/10 12:29:27 They are unused here too. I just shall remove them
}
exports.ElemHideEmulationFilter = ElemHideEmulationFilter;
ElemHideEmulationFilter.prototype = extend(ElemHideBase, {
- type: "elemhideemulation"
+ type: "elemhideemulation",
+ cssPropFilter: false,
+ abpSelectorFilter: false
});

Powered by Google App Engine
This is Rietveld