Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/elemHideEmulation.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Patch Set: Removed unused imports Created March 15, 2017, 3:11 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/elemHide.js ('k') | lib/events.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHideEmulation.js
diff --git a/lib/elemHideEmulation.js b/lib/elemHideEmulation.js
index 54c98222a80b3cdd19e2bfa7ac88846b2e0ef1c4..26ea169c7f750fa4be0e613578787992eea4fef9 100644
--- a/lib/elemHideEmulation.js
+++ b/lib/elemHideEmulation.js
@@ -15,25 +15,26 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+"use strict";
+
/**
* @fileOverview Element hiding emulation implementation.
*/
-let {ElemHide} = require("elemHide");
-let {Filter} = require("filterClasses");
+const {ElemHide} = require("elemHide");
+const {Filter} = require("filterClasses");
-var filters = Object.create(null);
+let filters = Object.create(null);
/**
* Container for element hiding emulation filters
* @class
*/
-let ElemHideEmulation = exports.ElemHideEmulation =
-{
+let ElemHideEmulation = {
/**
* Removes all known filters
*/
- clear: function()
+ clear()
{
filters = Object.create(null);
},
@@ -42,7 +43,7 @@ let ElemHideEmulation = exports.ElemHideEmulation =
* Add a new element hiding emulation filter
* @param {ElemHideEmulationFilter} filter
*/
- add: function(filter)
+ add(filter)
{
filters[filter.text] = true;
},
@@ -51,26 +52,30 @@ let ElemHideEmulation = exports.ElemHideEmulation =
* Removes an element hiding emulation filter
* @param {ElemHideEmulationFilter} filter
*/
- remove: function(filter)
+ remove(filter)
{
delete filters[filter.text];
},
/**
* Returns a list of all rules active on a particular domain
- * @param {String} domain
+ * @param {string} domain
* @return {ElemHideEmulationFilter[]}
*/
- getRulesForDomain: function(domain)
+ getRulesForDomain(domain)
{
let result = [];
let keys = Object.getOwnPropertyNames(filters);
for (let key of keys)
{
let filter = Filter.fromText(key);
- if (filter.isActiveOnDomain(domain) && !ElemHide.getException(filter, domain))
+ if (filter.isActiveOnDomain(domain) &&
+ !ElemHide.getException(filter, domain))
+ {
result.push(filter);
+ }
}
return result;
}
};
+exports.ElemHideEmulation = ElemHideEmulation;
« no previous file with comments | « lib/elemHide.js ('k') | lib/events.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld