From 13b1c4518eb73915a211a7639a5cd9b815e3ce97 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sun, 19 Jan 2014 23:07:12 +0100 Subject: [PATCH] Better check if a none dimension element is hintable (#62). --- src/hints.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hints.js b/src/hints.js index cb4a503..d4e6fa3 100644 --- a/src/hints.js +++ b/src/hints.js @@ -120,6 +120,18 @@ Object.freeze((function(){ return false; } + if ((!rect.width || !rect.height) && (e.textContent || !e.name)) { + var arr = Array.prototype.slice.call(e.childNodes); + var check = function(e) { + return e instanceof Element + && e.style.float != "none" + && isVisible(e); + }; + if (!arr.some(check)) { + return false; + } + } + var s = win.getComputedStyle(e, null); return s.display !== "none" && s.visibility == "visible"; } -- 2.20.1