Index: lib/filterClasses.js |
diff --git a/lib/filterClasses.js b/lib/filterClasses.js |
index 626eabad9538553550f08df724b14fbd077cd08b..504cd4b84503152459684997f83c5298947758b1 100644 |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -81,7 +81,7 @@ Filter.prototype = |
* Cache for known filters, maps string representation to filter objects. |
* @type {Object} |
*/ |
-Filter.knownFilters = Object.create(null); |
+Filter.knownFilters = new Map(); |
/** |
* Regular expression that element hiding filters should match |
@@ -108,8 +108,8 @@ Filter.optionsRegExp = /\$(~?[\w-]+(?:=[^,\s]+)?(?:,~?[\w-]+(?:=[^,\s]+)?)*)$/; |
*/ |
Filter.fromText = function(text) |
{ |
- if (text in Filter.knownFilters) |
- return Filter.knownFilters[text]; |
+ if (Filter.knownFilters.has(text)) |
+ return Filter.knownFilters.get(text); |
Wladimir Palant
2017/09/20 08:59:10
It makes little sense to have two calls here. You
sergei
2017/09/20 09:22:40
I also thought about it because there are no `unde
|
let ret; |
let match = (text.includes("#") ? Filter.elemhideRegExp.exec(text) : null); |
@@ -136,7 +136,7 @@ Filter.fromText = function(text) |
else |
ret = RegExpFilter.fromText(text); |
- Filter.knownFilters[ret.text] = ret; |
+ Filter.knownFilters.set(ret.text, ret); |
return ret; |
}; |