Skip to content

Commit

Permalink
fix gorhill#1955: discard cosmetic filters with pseudo-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Sep 1, 2016
1 parent 43d699b commit 4851bc4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/cosmetic-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4851bc4

Please sign in to comment.