MCPcopy
hub / github.com/SeleniumHQ/selenium / displayed

Function displayed

javascript/atoms/typescript/is-displayed.ts:473–510  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

471 }
472
473 function displayed(node: Node): boolean {
474 var cached = displayedCache.get(node);
475 if (cached !== undefined) {
476 return cached;
477 }
478
479 if (isElement(node)) {
480 var display = getEffectiveStyle(node, 'display');
481 var contentVisibility = getEffectiveStyle(node, 'content-visibility');
482 if (display === 'none' || contentVisibility === 'hidden') {
483 displayedCache.set(node, false);
484 return false;
485 }
486 }
487
488 var parent = getParentNodeInComposedDom(node);
489 if (typeof ShadowRoot === 'function' && parent instanceof ShadowRoot) {
490 if (parent.host.shadowRoot && parent.host.shadowRoot !== parent) {
491 displayedCache.set(node, false);
492 return false;
493 }
494 parent = parent.host;
495 }
496
497 if (parent && (parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE)) {
498 displayedCache.set(node, true);
499 return true;
500 }
501
502 if (isElement(parent, 'DETAILS') && !(<HTMLDetailsElement>parent).open && !isElement(node, 'SUMMARY')) {
503 displayedCache.set(node, false);
504 return false;
505 }
506
507 var result = !!parent && displayed(parent);
508 displayedCache.set(node, result);
509 return result;
510 }
511
512 return isShownInternal(elem, !!optIgnoreOpacity, displayed);
513})

Callers

nothing calls this directly

Calls 5

getEffectiveStyleFunction · 0.85
isElementFunction · 0.70
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected