Commit 97abe4b5 97abe4b58af2fafd6ef36a3efa69e48607a9eb3e by Nicolas Perriault

fixed elem visibility computation method - refs #715

1 parent 9eb64d1e
......@@ -130,19 +130,24 @@
/**
* Checks if a given DOM element is visible in remove page.
*
* @param Object element DOM element
* @param Object element DOM element
* @return Boolean
*/
this.elementVisible = function elementVisible(elem) {
var style;
try {
var comp = window.getComputedStyle(elem, null);
return comp.visibility !== 'hidden' &&
comp.display !== 'none' &&
elem.offsetHeight > 0 &&
elem.offsetWidth > 0;
style = window.getComputedStyle(elem, null);
} catch (e) {
return false;
}
var hidden = style.visibility === 'hidden' || style.display === 'none';
if (hidden) {
return false;
}
if (style.display === "inline") {
return true;
}
return elem.clientHeight > 0 && elem.clientWidth > 0;
}
/**
......
......@@ -14,4 +14,4 @@
<img src="images/phantom.png" id="img2">
<img src="images/phantom.png" id="img3" style="visibility:hidden">
</body>
</html>
\ No newline at end of file
</html>
......