1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 01:59:38 +02:00

fix #1955: discard cosmetic filters with pseudo-classes

This commit is contained in:
gorhill 2016-09-01 15:54:01 -04:00
parent 43d699b1e2
commit 4851bc4f34

View File

@ -330,7 +330,7 @@ FilterParser.prototype.parse = function(raw) {
}
// Extract the selector.
this.suffix = raw.slice(rpos + 1);
this.suffix = raw.slice(rpos + 1).trim();
if ( this.suffix.length === 0 ) {
this.cosmetic = false;
return this;
@ -791,10 +791,12 @@ FilterContainer.prototype.isValidSelector = (function() {
var reStyleSelector = /^(.+?):style\((.+?)\)$/;
var reStyleBad = /url\([^)]+\)/;
// Keep in mind: https://github.com/gorhill/uBlock/issues/693
// Keep in mind:
// https://github.com/gorhill/uBlock/issues/693
// https://github.com/gorhill/uBlock/issues/1955
var isValidCSSSelector = function(s) {
try {
div[matchesProp](s + ',\n#foo');
div[matchesProp](s + ', ' + s + ':not(#foo)');
} catch (ex) {
return false;
}