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 |