File tree 1 file changed +9
-11
lines changed
1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,17 @@ function hidesContents(element) {
18
18
// If the node is empty, this is good enough
19
19
if ( zeroSize && ! element . innerHTML ) return true ;
20
20
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 ) {
24
30
return false ;
25
31
}
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" ;
34
32
}
35
33
36
34
function visible ( element ) {
You can’t perform that action at this time.
0 commit comments