MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / isElement

Function isElement

javascript/atoms/typescript/is-displayed.ts:59–75  ·  view source on GitHub ↗
(node: unknown, tagName?: string)

Source from the content-addressed store, hash-verified

57 }
58
59 function isElement(node: unknown, tagName?: string): node is Element {
60 // Use nodeType instead of instanceof to handle cross-realm Elements
61 // (e.g., from iframes), where instanceof checks against a different Element.
62 if (!node || (node as Node).nodeType !== 1 /* ELEMENT_NODE */) {
63 return false;
64 }
65 var asElement = node as Element;
66 var rawTagName = tagNameDescriptor && typeof tagNameDescriptor.get === 'function'
67 ? tagNameDescriptor.get.call(asElement)
68 : asElement.tagName;
69 var upperTagName = typeof rawTagName === 'string' ? rawTagName.toUpperCase() : '';
70 var normalizedTagName = toUpperCaseTag(tagName);
71 if (upperTagName === 'FORM') {
72 return !normalizedTagName || normalizedTagName === 'FORM';
73 }
74 return !!upperTagName && (!normalizedTagName || upperTagName === normalizedTagName);
75 }
76
77 function getParentElement(node: Node): Element | null {
78 var current = node.parentNode;

Callers 5

maybeFindImageMapFunction · 0.70
isShownInternalFunction · 0.70
positiveSizeFunction · 0.70
hiddenByOverflowFunction · 0.70
displayedFunction · 0.70

Calls 2

toUpperCaseTagFunction · 0.85
callMethod · 0.65

Tested by

no test coverage detected