Index: lib/filterClasses.js |
=================================================================== |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -183,18 +183,18 @@ |
// Don't remove spaces inside comments |
if (/^ *!/.test(text)) |
return text.trim(); |
// Special treatment for element hiding filters, right side is allowed to |
// contain spaces |
if (Filter.elemhideRegExp.test(text)) |
{ |
- let [, domain, separator, selector] = /^(.*?)(#@?#?)(.*)$/.exec(text); |
- return domain.replace(/ +/g, "") + separator + selector.trim(); |
+ let [, domains, separator, selector] = /^(.*?)(#@?#?)(.*)$/.exec(text); |
+ return domains.replace(/ +/g, "") + separator + selector.trim(); |
} |
// For most regexp filters we strip all spaces, but $csp filter options |
// are allowed to contain single (non trailing) spaces. |
let strippedText = text.replace(/ +/g, ""); |
if (!strippedText.includes("$") || !/\bcsp=/i.test(strippedText)) |
return strippedText; |
@@ -960,18 +960,18 @@ |
* @augments ActiveFilter |
*/ |
function ElemHideBase(text, domains, selector) |
{ |
ActiveFilter.call(this, text, domains || null); |
if (domains) |
{ |
- this.selectorDomain = domains.replace(/,~[^,]+/g, "") |
- .replace(/^~[^,]+,?/, "").toLowerCase(); |
+ 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, { |
@@ -981,62 +981,62 @@ |
domainSeparator: ",", |
/** |
* @see ActiveFilter.ignoreTrailingDot |
*/ |
ignoreTrailingDot: false, |
/** |
- * Host name or domain the filter should be restricted to (can be null for |
+ * Host names or domains the filter should be restricted to (can be null for |
* no restriction) |
* @type {string} |
*/ |
- selectorDomain: null, |
+ selectorDomains: null, |
/** |
* CSS selector for the HTML elements that should be hidden |
* @type {string} |
*/ |
selector: null |
}); |
/** |
* Creates an element hiding filter from a pre-parsed text representation |
* |
* @param {string} text same as in Filter() |
- * @param {string?} domain |
- * domain part of the text representation |
+ * @param {string?} domains |
+ * domains part of the text representation |
* @param {string?} type |
* rule type, either empty or @ (exception) or ? (emulation rule) |
* @param {string} selector raw CSS selector |
* @return {ElemHideFilter|ElemHideException| |
* ElemHideEmulationFilter|InvalidFilter} |
*/ |
-ElemHideBase.fromText = function(text, domain, type, selector) |
+ElemHideBase.fromText = function(text, domains, type, selector) |
{ |
// We don't allow ElemHide filters which have any empty domains. |
// Note: The ElemHide.prototype.domainSeparator is duplicated here, if that |
// changes this must be changed too. |
- if (domain && /(^|,)~?(,|$)/.test(domain)) |
+ if (domains && /(^|,)~?(,|$)/.test(domains)) |
return new InvalidFilter(text, "filter_invalid_domain"); |
if (type == "@") |
- return new ElemHideException(text, domain, selector); |
+ return new ElemHideException(text, domains, selector); |
if (type == "?") |
{ |
// 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)) |
+ if (!/,[^~][^,.]*\.[^,]/.test("," + domains)) |
return new InvalidFilter(text, "filter_elemhideemulation_nodomain"); |
- return new ElemHideEmulationFilter(text, domain, selector); |
+ return new ElemHideEmulationFilter(text, domains, selector); |
} |
- return new ElemHideFilter(text, domain, selector); |
+ return new ElemHideFilter(text, domains, selector); |
}; |
/** |
* Class for element hiding filters |
* @param {string} text see Filter() |
* @param {string} domains see ElemHideBase() |
* @param {string} selector see ElemHideBase() |
* @constructor |