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

Unified Diff: lib/elemHide.js

Issue 29807560: Issue 6745 - Prefer strict equality operator (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 14, 2018, 4:11 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
« no previous file with comments | « lib/downloader.js ('k') | lib/events.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHide.js
===================================================================
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -70,17 +70,17 @@
* @param {Filter} filter
*/
function addToFiltersByDomain(filter)
{
let domains = filter.domains || defaultDomains;
for (let [domain, isIncluded] of domains)
{
// There's no need to note that a filter is generically disabled.
- if (!isIncluded && domain == "")
+ if (!isIncluded && domain === "")
continue;
let filters = filtersByDomain.get(domain);
if (!filters)
filtersByDomain.set(domain, filters = new Map());
filters.set(filter, isIncluded);
}
}
@@ -174,17 +174,17 @@
if (filter instanceof ElemHideException)
{
let list = exceptions.get(filter.selector);
let index = list.indexOf(filter);
if (index >= 0)
list.splice(index, 1);
}
// Unconditially applied element hiding filters
- else if (filterBySelector.get(filter.selector) == filter)
+ else if (filterBySelector.get(filter.selector) === filter)
{
filterBySelector.delete(filter.selector);
unconditionalSelectors = null;
}
// Conditionally applied element hiding filters
else
{
let domains = filter.domains || defaultDomains;
@@ -235,41 +235,41 @@
let excluded = new Set();
let currentDomain = domain ? domain.replace(/\.+$/, "").toUpperCase() : "";
// This code is a performance hot-spot, which is why we've made certain
// micro-optimisations. Please be careful before making changes.
while (true)
{
- if (specificOnly && currentDomain == "")
+ if (specificOnly && currentDomain === "")
break;
let filters = filtersByDomain.get(currentDomain);
if (filters)
{
for (let [filter, isIncluded] of filters)
{
if (!isIncluded)
{
excluded.add(filter);
}
- else if ((excluded.size == 0 || !excluded.has(filter)) &&
+ else if ((excluded.size === 0 || !excluded.has(filter)) &&
!this.getException(filter, domain))
{
selectors.push(filter.selector);
}
}
}
- if (currentDomain == "")
+ if (currentDomain === "")
break;
let nextDot = currentDomain.indexOf(".");
- currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1);
+ currentDomain = nextDot === -1 ? "" : currentDomain.substr(nextDot + 1);
}
if (!specificOnly)
selectors = getUnconditionalSelectors().concat(selectors);
return selectors;
}
};
« no previous file with comments | « lib/downloader.js ('k') | lib/events.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld