Better check if a none dimension element is hintable (#62).
authorDaniel Carl <danielcarl@gmx.de>
Sun, 19 Jan 2014 22:07:12 +0000 (23:07 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Sun, 19 Jan 2014 22:14:17 +0000 (23:14 +0100)
src/hints.js

index cb4a503..d4e6fa3 100644 (file)
@@ -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";
             }