Commit 97abe4b5 97abe4b58af2fafd6ef36a3efa69e48607a9eb3e by Nicolas Perriault

fixed elem visibility computation method - refs #715

1 parent 9eb64d1e
...@@ -130,19 +130,24 @@ ...@@ -130,19 +130,24 @@
130 /** 130 /**
131 * Checks if a given DOM element is visible in remove page. 131 * Checks if a given DOM element is visible in remove page.
132 * 132 *
133 * @param Object element DOM element 133 * @param Object element DOM element
134 * @return Boolean 134 * @return Boolean
135 */ 135 */
136 this.elementVisible = function elementVisible(elem) { 136 this.elementVisible = function elementVisible(elem) {
137 var style;
137 try { 138 try {
138 var comp = window.getComputedStyle(elem, null); 139 style = window.getComputedStyle(elem, null);
139 return comp.visibility !== 'hidden' &&
140 comp.display !== 'none' &&
141 elem.offsetHeight > 0 &&
142 elem.offsetWidth > 0;
143 } catch (e) { 140 } catch (e) {
144 return false; 141 return false;
145 } 142 }
143 var hidden = style.visibility === 'hidden' || style.display === 'none';
144 if (hidden) {
145 return false;
146 }
147 if (style.display === "inline") {
148 return true;
149 }
150 return elem.clientHeight > 0 && elem.clientWidth > 0;
146 } 151 }
147 152
148 /** 153 /**
......
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
14 <img src="images/phantom.png" id="img2"> 14 <img src="images/phantom.png" id="img2">
15 <img src="images/phantom.png" id="img3" style="visibility:hidden"> 15 <img src="images/phantom.png" id="img3" style="visibility:hidden">
16 </body> 16 </body>
17 </html>
...\ No newline at end of file ...\ No newline at end of file
17 </html>
......