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: Created June 14, 2017, 3:18 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 | 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
@@ -192,18 +192,16 @@
const incompletePrefixRegexp = /[\s>+~]$/;
function HasSelector(selectors)
{
this._innerSelectors = selectors;
}
HasSelector.prototype = {
- requiresHiding: true,
-
*getSelectors(prefix, subtree, styles)
{
for (let element of this.getElements(prefix, subtree, styles))
yield [makeSelector(element, ""), element];
},
/**
* Generator function returning selected elements.
@@ -241,16 +239,18 @@
}
else
regexpString = filterToRegExp(propertyExpression);
this._regexp = new RegExp(regexpString, "i");
}
PropsSelector.prototype = {
+ hideWithStyleSheet: true,
+
*findPropsSelectors(styles, prefix, regexp)
{
for (let style of styles)
if (regexp.test(style.style))
for (let subSelector of style.subSelectors)
yield prefix + subSelector;
},
@@ -372,17 +372,17 @@
}
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.hideWithStyleSheet))
Wladimir Palant 2017/06/19 08:28:32 This logic reversal is wrong - any filter containi
hub 2017/06/19 13:37:15 Done.
{
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