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

Unified Diff: lib/filterClasses.js

Issue 29788574: Noissue - Remove ElemHideBase.selectorDomains (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created May 24, 2018, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -991,22 +991,16 @@
* hidden
* @constructor
* @augments ActiveFilter
*/
function ElemHideBase(text, domains, selector)
{
ActiveFilter.call(this, text, domains || null);
- if (domains)
- {
- this.selectorDomains = domains.replace(/,~[^,]+/g, "")
- .replace(/^~[^,]+,?/, "").toLowerCase();
- }
-
// Braces are being escaped to prevent CSS rule injection.
this.selector = selector.replace("{", "\\7B ").replace("}", "\\7D ");
}
exports.ElemHideBase = ElemHideBase;
ElemHideBase.prototype = extend(ActiveFilter, {
/**
* @see ActiveFilter.domainSeparator
@@ -1014,26 +1008,35 @@
domainSeparator: ",",
/**
* @see ActiveFilter.ignoreTrailingDot
*/
ignoreTrailingDot: false,
/**
- * Host names or domains the filter should be restricted to (can be null for
- * no restriction)
- * @type {?string}
- */
- selectorDomains: null,
- /**
* CSS selector for the HTML elements that should be hidden
* @type {string}
*/
- selector: null
+ selector: null,
+
+ /**
+ * Host names or domains the filter should be restricted to (can be null for
+ * no restriction)
+ * @type {?Array.<string>}
+ */
+ get selectorDomains()
+ {
+ let {domains} = this;
+ if (!domains)
+ return null;
+
+ return [...domains].filter(([domain, isIncluded]) => isIncluded)
+ .map(([domain]) => domain.toLowerCase());
+ }
});
/**
* Creates an element hiding filter from a pre-parsed text representation
*
* @param {string} text same as in Filter()
* @param {string} [domains]
* domains part of the text representation
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld