diff --git a/js/element-picker.js b/js/element-picker.js index 6b04878b9..251c15db5 100644 --- a/js/element-picker.js +++ b/js/element-picker.js @@ -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(''); }; /******************************************************************************/