mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 11:22:38 +01:00
fix #1955: discard cosmetic filters with pseudo-classes
This commit is contained in:
parent
43d699b1e2
commit
4851bc4f34
@ -330,7 +330,7 @@ FilterParser.prototype.parse = function(raw) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract the selector.
|
// Extract the selector.
|
||||||
this.suffix = raw.slice(rpos + 1);
|
this.suffix = raw.slice(rpos + 1).trim();
|
||||||
if ( this.suffix.length === 0 ) {
|
if ( this.suffix.length === 0 ) {
|
||||||
this.cosmetic = false;
|
this.cosmetic = false;
|
||||||
return this;
|
return this;
|
||||||
@ -791,10 +791,12 @@ FilterContainer.prototype.isValidSelector = (function() {
|
|||||||
var reStyleSelector = /^(.+?):style\((.+?)\)$/;
|
var reStyleSelector = /^(.+?):style\((.+?)\)$/;
|
||||||
var reStyleBad = /url\([^)]+\)/;
|
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) {
|
var isValidCSSSelector = function(s) {
|
||||||
try {
|
try {
|
||||||
div[matchesProp](s + ',\n#foo');
|
div[matchesProp](s + ', ' + s + ':not(#foo)');
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user