Index: lib/filterClasses.js |
diff --git a/lib/filterClasses.js b/lib/filterClasses.js |
index 626eabad9538553550f08df724b14fbd077cd08b..417e4d8df3cc13fdd4daa0d6ac14489ad73b92cb 100644 |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -79,9 +79,9 @@ Filter.prototype = |
/** |
* Cache for known filters, maps string representation to filter objects. |
- * @type {Object} |
+ * @type {Map.<string,Filter>} |
*/ |
-Filter.knownFilters = Object.create(null); |
+Filter.knownFilters = new Map(); |
/** |
* Regular expression that element hiding filters should match |
@@ -108,10 +108,10 @@ Filter.optionsRegExp = /\$(~?[\w-]+(?:=[^,\s]+)?(?:,~?[\w-]+(?:=[^,\s]+)?)*)$/; |
*/ |
Filter.fromText = function(text) |
{ |
- if (text in Filter.knownFilters) |
- return Filter.knownFilters[text]; |
+ let ret = Filter.knownFilters.get(text); |
+ if (ret) |
kzar
2017/09/20 12:30:24
Just an observation since I don't think it matters
|
+ return ret; |
- let ret; |
let match = (text.includes("#") ? Filter.elemhideRegExp.exec(text) : null); |
if (match) |
{ |
@@ -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; |
}; |