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: Rebased. Created Feb. 28, 2017, 3:55 p.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
Index: lib/elemHideEmulation.js
diff --git a/lib/elemHideEmulation.js b/lib/elemHideEmulation.js
index 54c98222a80b3cdd19e2bfa7ac88846b2e0ef1c4..42d9cc7dab59e050f4a87ab38aeffb6c7ba92e11 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 = exports.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,24 +52,25 @@ 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;

Powered by Google App Engine
This is Rietveld