Index: lib/elemHide.js |
=================================================================== |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -113,30 +113,16 @@ |
let filters = filtersByDomain.get(domain); |
if (!filters) |
filtersByDomain.set(domain, filters = new Map()); |
filters.set(filter, isIncluded); |
} |
} |
} |
- |
-/** |
- * Checks whether a filter applies on a domain |
- * @param {Filter} filter |
- * @param {string} [domain] |
- * @param {Set.<Filter>} excludeSet |
- * @returns {boolean} |
- */ |
-function doesFilterApply(filter, domain, excludeSet) |
-{ |
- return (excludeSet.size == 0 || !excludeSet.has(filter)) && |
- !exports.ElemHide.getException(filter, domain); |
-} |
- |
/** |
* Returns a list of domain-specific filters matching a domain |
* @param {string} [domain] |
* @returns {Array.<{domain: string, filters: ?Map.<Filter,boolean>}>} |
*/ |
function getSpecificFiltersForDomain(domain) |
{ |
let filtersList = []; |
@@ -174,19 +160,24 @@ |
for (let i = 0; i < filtersList.length; i++) |
{ |
let {filters} = filtersList[i]; |
if (filters) |
{ |
for (let [filter, isIncluded] of filters) |
{ |
if (!isIncluded) |
+ { |
excludeSet.add(filter); |
- else if (doesFilterApply(filter, domain, excludeSet)) |
+ } |
+ else if ((excludeSet.size == 0 || !excludeSet.has(filter)) && |
+ !exports.ElemHide.getException(filter, domain)) |
+ { |
matches.push(filter.selector); |
+ } |
} |
} |
} |
return matches; |
} |
/** |