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

Unified Diff: chrome/content/elemHideEmulation.js

Issue 29464708: Issue 5314 - Allow hide emulation filters to be with a plain selector (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Updated the logic Created June 19, 2017, 1:36 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 | « no previous file | lib/filterClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/elemHideEmulation.js
===================================================================
--- a/chrome/content/elemHideEmulation.js
+++ b/chrome/content/elemHideEmulation.js
@@ -241,16 +241,18 @@
}
else
regexpString = filterToRegExp(propertyExpression);
this._regexp = new RegExp(regexpString, "i");
}
PropsSelector.prototype = {
+ preferHideWithSelector: true,
+
*findPropsSelectors(styles, prefix, regexp)
{
for (let style of styles)
if (regexp.test(style.style))
for (let subSelector of style.subSelectors)
yield prefix + subSelector;
},
@@ -371,17 +373,18 @@
}
let {document} = this.window;
for (let pattern of this.patterns)
{
for (let selector of evaluate(pattern.selectors,
0, "", document, cssStyles))
{
- if (!pattern.selectors.some(s => s.requiresHiding))
+ if (pattern.selectors.some(s => s.preferHideWithSelector) &&
+ !pattern.selectors.some(s => s.requiresHiding))
{
selectors.push(selector);
selectorFilters.push(pattern.text);
}
else
{
for (let element of document.querySelectorAll(selector))
{
« no previous file with comments | « no previous file | lib/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld