Index: lib/elemHide.js |
diff --git a/lib/elemHide.js b/lib/elemHide.js |
index e9243853e3733c83632710b690e69224f1983bea..3b0a9402eafe19fe2cd07539fe57e98e356a09ec 100644 |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -66,8 +66,8 @@ let unconditionalFilterKeys = null; |
/** |
* Object to be used instead when a filter has a blank domains property. |
*/ |
-let defaultDomains = Object.create(null); |
-defaultDomains[""] = true; |
+let defaultDomains = new Map(); |
+defaultDomains.set("", true); |
Wladimir Palant
2017/09/21 08:11:44
You can initialize the Map object immediately: new
sergei
2017/09/21 10:50:33
Done.
|
/** |
* Lookup table, keys are known element hiding exceptions |
@@ -104,13 +104,13 @@ let ElemHide = exports.ElemHide = { |
_addToFiltersByDomain(key, filter) |
{ |
let domains = filter.domains || defaultDomains; |
- for (let domain in domains) |
+ for (let [domain, isIncluded] of domains) |
{ |
let filters = filtersByDomain[domain]; |
if (!filters) |
filters = filtersByDomain[domain] = Object.create(null); |
Wladimir Palant
2017/09/21 08:11:44
Shouldn't this be turned in to a Map object as wel
sergei
2017/09/21 10:50:33
No, I find the change of filtersByDomain self-cont
|
- if (domains[domain]) |
+ if (isIncluded) |
filters[key] = filter; |
else |
filters[key] = false; |
@@ -182,7 +182,7 @@ let ElemHide = exports.ElemHide = { |
// We haven't found this filter in unconditional filters, look in |
// filtersByDomain. |
let domains = filter.domains || defaultDomains; |
- for (let domain in domains) |
+ for (let domain of domains.keys()) |
{ |
let filters = filtersByDomain[domain]; |
if (filters) |