mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 17:17:57 +01:00
make lighter cosmetic filters: use tagname only when no id, class
This commit is contained in:
parent
632aadedae
commit
3a5c413cab
1 changed files with 7 additions and 3 deletions
|
@ -258,7 +258,7 @@ var pickerRootDistance = function(elem) {
|
|||
/******************************************************************************/
|
||||
|
||||
var highlightElements = function(elems, force) {
|
||||
// To make mouse mouce handler more efficient
|
||||
// To make mouse move handler more efficient
|
||||
if ( !force && elems.length === targetElements.length ) {
|
||||
if ( elems.length === 0 || elems[0] === targetElements[0] ) {
|
||||
return;
|
||||
|
@ -347,7 +347,7 @@ var cosmeticFilterFromElement = function(elem) {
|
|||
return;
|
||||
}
|
||||
var tagName = elem.tagName.toLowerCase();
|
||||
var prefix = '##' + tagName;
|
||||
var prefix = '';
|
||||
var suffix = [];
|
||||
var v;
|
||||
|
||||
|
@ -368,6 +368,10 @@ var cosmeticFilterFromElement = function(elem) {
|
|||
suffix.push('.', v.join('.'));
|
||||
}
|
||||
|
||||
if ( suffix.length === 0 ) {
|
||||
prefix = tagName;
|
||||
}
|
||||
|
||||
// Attributes (depends on tag name)
|
||||
var attributes = [], attr;
|
||||
switch ( tagName ) {
|
||||
|
@ -401,7 +405,7 @@ var cosmeticFilterFromElement = function(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
return prefix + suffix.join('');
|
||||
return '##' + prefix + suffix.join('');
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in a new issue