(element)
| 25 | } |
| 26 | |
| 27 | function hidesContents(element) { |
| 28 | const zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0; |
| 29 | |
| 30 | // If the node is empty, this is good enough |
| 31 | if (zeroSize && !element.innerHTML) return true; |
| 32 | |
| 33 | try { |
| 34 | // Otherwise we need to check some styles |
| 35 | const style = window.getComputedStyle(element); |
| 36 | const displayValue = style.getPropertyValue("display"); |
| 37 | return zeroSize |
| 38 | ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style) |
| 39 | : displayValue === DISPLAY_NONE; |
| 40 | } catch (exception) { |
| 41 | // eslint-disable-next-line no-console |
| 42 | console.warn("Failed to inspect element style"); |
| 43 | return false; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | function visible(element) { |
| 48 | let parentElement = element; |
no test coverage detected
searching dependent graphs…