From: Daniel Carl Date: Sun, 19 Jan 2014 22:07:12 +0000 (+0100) Subject: Better check if a none dimension element is hintable (#62). X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=13b1c4518eb73915a211a7639a5cd9b815e3ce97;p=vimb.git Better check if a none dimension element is hintable (#62). --- 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"; }