checking element visibility through computed styles
Showing
1 changed file
with
8 additions
and
2 deletions
... | @@ -546,8 +546,14 @@ | ... | @@ -546,8 +546,14 @@ |
546 | */ | 546 | */ |
547 | this.visible = function visible(selector) { | 547 | this.visible = function visible(selector) { |
548 | try { | 548 | try { |
549 | var el = this.findOne(selector); | 549 | var comp, |
550 | return el && el.style.visibility !== 'hidden' && el.offsetHeight > 0 && el.offsetWidth > 0; | 550 | el = this.findOne(selector); |
551 | |||
552 | if (el) { | ||
553 | comp = window.getComputedStyle(el, null); | ||
554 | return comp.visibility !== 'hidden' && comp.display !== 'none' && el.offsetHeight > 0 && el.offsetWidth > 0; | ||
555 | } | ||
556 | return false; | ||
551 | } catch (e) { | 557 | } catch (e) { |
552 | return false; | 558 | return false; |
553 | } | 559 | } | ... | ... |
-
Please register or sign in to post a comment