From fba0bf73ef119f81ef5d12559d9f85b7f69ff48a Mon Sep 17 00:00:00 2001 From: Deathamns Date: Tue, 10 Feb 2015 18:59:27 +0100 Subject: [PATCH] Don't highlight the picker, handle empty filters --- src/js/element-picker.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/js/element-picker.js b/src/js/element-picker.js index c94857259..481bdd5f4 100644 --- a/src/js/element-picker.js +++ b/src/js/element-picker.js @@ -195,6 +195,9 @@ var highlightElements = function(elems, force) { var elem, rect, poly; for ( var i = 0; i < elems.length; i++ ) { elem = elems[i]; + if ( elem === pickerRoot ) { + continue; + } if ( typeof elem.getBoundingClientRect !== 'function' ) { continue; } @@ -386,6 +389,11 @@ var filtersFromElement = function(elem) { var elementsFromFilter = function(filter) { var out = []; + filter = filter.trim(); + if ( filter === '' ) { + return out; + } + // Cosmetic filters: these are straight CSS selectors // TODO: This is still not working well for a[href], because there are // many ways to compose a valid href to the same effective URL.