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

Unified Diff: lib/filterValidation.js

Issue 29401596: Issue 5094 - Implement support for :has() in chrome extension (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created April 3, 2017, 2:10 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
« include.preload.js ('K') | « include.preload.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterValidation.js
===================================================================
--- a/lib/filterValidation.js
+++ b/lib/filterValidation.js
@@ -14,17 +14,17 @@
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
/** @module filterValidation */
"use strict";
-const {Filter, InvalidFilter, ElemHideBase} = require("filterClasses");
+const {Filter, InvalidFilter, ElemHideBase, ElemHideEmulationFilter} = require("filterClasses");
const {Utils} = require("utils");
/**
* An error returned by
* {@link module:filterValidation.parseFilter parseFilter()} or
* {@link module:filterValidation.parseFilters parseFilters()}
* indicating that a given filter cannot be parsed,
* contains an invalid CSS selector or is a filter list header.
@@ -137,17 +137,19 @@ exports.parseFilter = text =>
filter = Filter.fromText(text);
if (filter instanceof InvalidFilter)
{
return {error: new FilterParsingError("invalid-filter",
{reason: filter.reason})};
}
- if (filter instanceof ElemHideBase && !isValidCSSSelector(filter.selector))
+ if (filter instanceof ElemHideBase &&
+ !filter instanceof ElemHideEmulationFilter &&
+ !isValidCSSSelector(filter.selector))
Sebastian Noack 2017/04/04 10:14:45 When we implemented CSS property filters we delibe
hub 2017/04/05 09:05:53 ok. this will need to have changes in the adblockp
hub 2017/04/05 13:18:43 I suggest that we use something like: [-abp-selec
Sebastian Noack 2017/04/05 14:58:49 This appears unnecessarily verbose (and potentiall
hub 2017/04/05 15:44:57 How do you express ":has(:has(...))"? The idea w
Sebastian Noack 2017/04/05 16:08:28 I see, nesting might become ugly, mostly because o
{
return {error: new FilterParsingError("invalid-css-selector",
{selector: filter.selector})};
}
}
return {filter};
};
« include.preload.js ('K') | « include.preload.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld