MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / appendTextFromElement

Function appendTextFromElement

javascript/atoms/typescript/get-text.ts:242–256  ·  view source on GitHub ↗
(elem: Element, lines: string[])

Source from the content-addressed store, hash-verified

240// Flat-DOM traversal: no Shadow DOM awareness.
241// (dom.js lines 1127-1140: bot.dom.appendVisibleTextLinesFromElement_)
242function appendTextFromElement(elem: Element, lines: string[]): void {
243 appendTextFromElementCommon(
244 elem,
245 lines,
246 isShown,
247 function (node, lines, shown, whitespace, textTransform) {
248 if (node.nodeType === Node.TEXT_NODE && shown) {
249 appendTextFromTextNode(
250 node as Text, lines, whitespace, textTransform)
251 } else if (isElement(node)) {
252 appendTextFromElement(node as Element, lines)
253 }
254 },
255 )
256}
257
258// Whether a node has been distributed (slotted) into a Shadow DOM element to
259// be rendered elsewhere. When true the node must not be appended from its

Callers 1

getTextFunction · 0.85

Calls 3

appendTextFromTextNodeFunction · 0.85
isElementFunction · 0.50

Tested by

no test coverage detected