diff --git a/lib/chrome.js b/lib/chrome.js index 09edf3f..1697a3b 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -561,7 +561,7 @@ var ChromeObject = function() { + ' var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {' + ' var el = x.querySelector("' + subSelector + '");' + ' var keywords = decodeURIComponent("' + encodeURIComponent(searchText) + '").split(" ");' - + ' var text = [el.innerText, el.getAttribute("aria-label"), el.getAttribute("class")].join(" ");' + + ' var text = el instanceof HTMLElement ? [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) {'