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

Unified Diff: chrome/content/elemHideEmulation.js

Issue 29372676: [adblockpluscore] Issue 4825 - Let ElemHideEmulation associate selector and filter when calling add… (Closed)
Patch Set: Changed map to two arrays Created Feb. 9, 2017, 8:05 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/elemHideEmulation.js
diff --git a/chrome/content/elemHideEmulation.js b/chrome/content/elemHideEmulation.js
index 95a4c5d4ba314ce0c5697c626e52e62edbde574c..82912c51cfdff241d5cc886ee49c0422b082cb0c 100644
--- a/chrome/content/elemHideEmulation.js
+++ b/chrome/content/elemHideEmulation.js
@@ -80,26 +80,26 @@ ElemHideEmulation.prototype = {
if (!this.isSameOrigin(stylesheet))
return;
- var rules = stylesheet.cssRules;
+ let rules = stylesheet.cssRules;
if (!rules)
return;
- for (var i = 0; i < rules.length; i++)
+ for (let rule of rules)
{
- var rule = rules[i];
if (rule.type != rule.STYLE_RULE)
continue;
- var style = this.stringifyStyle(rule.style);
- for (var j = 0; j < this.patterns.length; j++)
+ let style = this.stringifyStyle(rule.style);
+ for (let pattern of this.patterns)
{
- var pattern = this.patterns[j];
if (pattern.regexp.test(style))
{
- var subSelectors = splitSelector(rule.selectorText);
- for (var k = 0; k < subSelectors.length; k++)
- selectors.push(pattern.prefix + subSelectors[k] + pattern.suffix);
- filters[pattern.text] = true;
+ let subSelectors = splitSelector(rule.selectorText);
+ for (let subSelector of subSelectors)
+ {
+ selectors.push(pattern.prefix + subSelector + pattern.suffix);
+ filters.push(pattern.text);
+ }
}
}
}
@@ -108,10 +108,10 @@ ElemHideEmulation.prototype = {
addSelectors: function(stylesheets)
{
var selectors = [];
- var filters = {};
+ var filters = [];
for (var i = 0; i < stylesheets.length; i++)
this.findSelectors(stylesheets[i], selectors, filters);
- this.addSelectorsFunc(selectors, Object.keys(filters));
+ this.addSelectorsFunc(selectors, filters);
},
onLoad: function(event)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld