File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,17 @@ function hidesContents(element) {
1818 // If the node is empty, this is good enough
1919 if ( zeroSize && ! element . innerHTML ) return true ;
2020
21- // if the element is not of type Element e.g. shadowRoot
22- // we cannot go any further
23- if ( ! element . isPrototypeOf ( Element ) ) {
21+ try {
22+ // Otherwise we need to check some styles
23+ const style = window . getComputedStyle ( element ) ;
24+ return zeroSize
25+ ? style . getPropertyValue ( "overflow" ) !== "visible" ||
26+ // if 'overflow: visible' set, check if there is actually any overflow
27+ ( element . scrollWidth <= 0 && element . scrollHeight <= 0 )
28+ : style . getPropertyValue ( "display" ) == "none" ;
29+ } catch ( exception ) {
2430 return false ;
2531 }
26-
27- // Otherwise we need to check some styles
28- const style = window . getComputedStyle ( element ) ;
29- return zeroSize
30- ? style . getPropertyValue ( "overflow" ) !== "visible" ||
31- // if 'overflow: visible' set, check if there is actually any overflow
32- ( element . scrollWidth <= 0 && element . scrollHeight <= 0 )
33- : style . getPropertyValue ( "display" ) == "none" ;
3432}
3533
3634function visible ( element ) {
You can’t perform that action at this time.
0 commit comments