diff --git a/lib/chrome.js b/lib/chrome.js index b7c4d04..cb92ac1 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -558,7 +558,9 @@ var ChromeObject = function() { s += '(function() {' + ' var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {' + ' var el = x.querySelector("' + subSelector + '");' - + ' return ([el.innerText, el.getAttribute("aria-label"), el.getAttribute("class")].join(" ").indexOf(decodeURIComponent("' + encodeURIComponent(searchText) + '")) > -1);' + + ' var keywords = decodeURIComponent("' + encodeURIComponent(searchText) + '").split(" ");' + + ' var text = [el.innerText, el.getAttribute("aria-label"), el.getAttribute("class")].join(" ");' + + ' return (text.split(" ").filter(function(w) { return keywords.indexOf(w) > -1; }).length >= keywords.length);' + ' });' + ' if (elements.length > 0) {' + ' var rect = elements[0].getBoundingClientRect();'