mirror of https://github.com/gorhill/uBlock.git
minor code review
This commit is contained in:
parent
fd1ccebf41
commit
3b61f7d11d
|
@ -64,10 +64,6 @@ if ( injectedSelectors.length === 0 ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/1015
|
||||
// Remove runtime prefix used to augment the specificity of our CSS rules.
|
||||
var reSpecificityBooster = /^:root\s+/;
|
||||
|
||||
var matchedSelectors = [];
|
||||
var selector;
|
||||
|
||||
|
@ -81,7 +77,9 @@ while ( i-- ) {
|
|||
continue;
|
||||
}
|
||||
loggedSelectors[selector] = true;
|
||||
matchedSelectors.push(selector.replace(reSpecificityBooster, ''));
|
||||
// https://github.com/gorhill/uBlock/issues/1015
|
||||
// Discard `:root ` prefix.
|
||||
matchedSelectors.push(selector.slice(6));
|
||||
}
|
||||
|
||||
vAPI.loggedSelectors = loggedSelectors;
|
||||
|
|
|
@ -693,9 +693,6 @@ var cosmeticFilterFromTarget = function(nid, coarseSelector) {
|
|||
/******************************************************************************/
|
||||
|
||||
var cosmeticFilterMapper = (function() {
|
||||
// https://github.com/gorhill/uBlock/issues/1015
|
||||
var reSpecificityBooster = /^:root\s+/;
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/546
|
||||
var matchesFnName;
|
||||
if ( typeof document.body.matches === 'function' ) {
|
||||
|
@ -717,7 +714,9 @@ var cosmeticFilterMapper = (function() {
|
|||
var i = selectors.length;
|
||||
var selector, nodes, j, node;
|
||||
while ( i-- ) {
|
||||
selector = selectors[i].replace(reSpecificityBooster, '');
|
||||
// https://github.com/gorhill/uBlock/issues/1015
|
||||
// Discard `:root ` prefix.
|
||||
selector = selectors[i].slice(6);
|
||||
if ( filterMap.has(rootNode) === false && rootNode[matchesFnName](selector) ) {
|
||||
filterMap.set(rootNode, selector);
|
||||
hideNode(node);
|
||||
|
|
Loading…
Reference in New Issue