Skip to content

Commit

Permalink
fix uBlockOrigin/uBlock-issues#341, and further work for #3683
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill authored and hawkeye116477 committed Jun 28, 2020
1 parent 6eb8a17 commit d4ea828
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/js/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ vAPI.DOMFilterer = (function() {
[ ':matches-css', PSelectorMatchesCSSTask ],
[ ':matches-css-after', PSelectorMatchesCSSAfterTask ],
[ ':matches-css-before', PSelectorMatchesCSSBeforeTask ],
[ ':not', PSelectorIfNotTask ],
[ ':xpath', PSelectorXpathTask ]
]);
}
Expand Down
8 changes: 7 additions & 1 deletion src/js/static-ext-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
'matches-css',
'matches-css-after',
'matches-css-before',
'not',
'xpath'
].join('|'),
')\\('
Expand Down Expand Up @@ -209,6 +210,9 @@
};

var compileConditionalSelector = function(s) {
if ( isValidCSSSelector(s) ) {
return { selector: s, tasks: [] };
}
// https://github.com/AdguardTeam/ExtendedCss/issues/31#issuecomment-302391277
// Prepend `:scope ` if needed.
if ( reNeedScope.test(s) ) {
Expand Down Expand Up @@ -241,6 +245,7 @@
[ ':matches-css', compileCSSDeclaration ],
[ ':matches-css-after', compileCSSDeclaration ],
[ ':matches-css-before', compileCSSDeclaration ],
[ ':not', compileConditionalSelector ],
[ ':xpath', compileXpathExpression ]
]);

Expand Down Expand Up @@ -293,7 +298,8 @@
raw.push(':has', '(', decompile(task[1]), ')');
break;
case ':if-not':
raw.push(task[0], '(', decompile(task[1]), ')');
case ':not':
raw.push(':not', '(', decompile(task[1]), ')');
break;
}
}
Expand Down

0 comments on commit d4ea828

Please sign in to comment.