mirror of https://github.com/gorhill/uBlock.git
This commit is contained in:
parent
5502a03f50
commit
1aa5497841
|
@ -1044,9 +1044,12 @@ var candidateFromFilterChoice = function(filterChoice) {
|
||||||
// TODO: should remove tag name too? ¯\_(ツ)_/¯
|
// TODO: should remove tag name too? ¯\_(ツ)_/¯
|
||||||
if ( filterChoice.modifier ) {
|
if ( filterChoice.modifier ) {
|
||||||
filter = filter.replace(/:nth-of-type\(\d+\)/, '');
|
filter = filter.replace(/:nth-of-type\(\d+\)/, '');
|
||||||
if ( filter.indexOf('.') !== -1 ) {
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/162
|
||||||
if ( filter.charAt(2) === '#' ) {
|
// Mind escaped periods: they do not denote a class identifier.
|
||||||
filter = filter.replace(/#[^#.]+/, '');
|
if ( filter.charAt(2) === '#' ) {
|
||||||
|
let pos = filter.search(/[^\\]\./);
|
||||||
|
if ( pos !== -1 ) {
|
||||||
|
filter = '##' + filter.slice(pos + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filter;
|
return filter;
|
||||||
|
@ -1057,8 +1060,10 @@ var candidateFromFilterChoice = function(filterChoice) {
|
||||||
for ( ; slot < filters.length; slot++ ) {
|
for ( ; slot < filters.length; slot++ ) {
|
||||||
filter = filters[slot];
|
filter = filters[slot];
|
||||||
// Remove all classes when an id exists.
|
// Remove all classes when an id exists.
|
||||||
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/162
|
||||||
|
// Mind escaped periods: they do not denote a class identifier.
|
||||||
if ( filter.charAt(2) === '#' ) {
|
if ( filter.charAt(2) === '#' ) {
|
||||||
filter = filter.replace(/\..+$/, '');
|
filter = filter.replace(/([^\\])\..+$/, '$1');
|
||||||
}
|
}
|
||||||
selector = filter.slice(2) + joiner + selector;
|
selector = filter.slice(2) + joiner + selector;
|
||||||
// Stop at any element with an id: these are unique in a web page
|
// Stop at any element with an id: these are unique in a web page
|
||||||
|
|
Loading…
Reference in New Issue