MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / isVisible

Function isVisible

tests/utilities.mjs:4–20  ·  view source on GitHub ↗
(element)

Source from the content-addressed store, hash-verified

2// Asserting the output of this is the equal of running
3// expect(element).toBeVisible()
4export function isVisible(element) {
5 while (element) {
6 const style = element.ownerDocument.defaultView.getComputedStyle(element);
7 if (
8 style.display === 'none' ||
9 style.visibility === 'hidden' ||
10 style.visibility === 'collapse' ||
11 style.opacity === '0' ||
12 style.opacity === 0 ||
13 element.hasAttribute('hidden')
14 ) {
15 return false;
16 }
17 element = element.parentElement;
18 }
19 return true;
20}

Callers 3

index.test.jsxFile · 0.90
index.test.jsxFile · 0.90
index.test.jsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected