MCPcopy Create free account
hub / github.com/angular/angular / getFirstChild

Function getFirstChild

packages/core/src/util/dom.ts:80–90  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

78 * See `getNextSibling` for more information on clobbering.
79 */
80export function getFirstChild(node: Node): Node | null {
81 const firstChild = node.firstChild;
82 // Make sure there is no `firstChild` clobbering: the real first child has
83 // `node` as its parent and no previous sibling. Note that checking whether
84 // the node is a descendant isn't enough, since a clobbering form control is
85 // typically located inside the form itself.
86 if (firstChild && (firstChild.parentNode !== node || firstChild.previousSibling !== null)) {
87 throw clobberedElementError(firstChild);
88 }
89 return firstChild;
90}
91
92/** Gets a reasonable nodeName, even for clobbered nodes. */
93export function getNodeName(node: Node): string {

Callers 7

sanitizeChildrenMethod · 0.90
walkIcuTreeFunction · 0.90
locateNextRNodeFunction · 0.90
navigateToNodeFunction · 0.90
findHydrationRootFunction · 0.90
collectI18nNodesFromDomFunction · 0.90

Calls 1

clobberedElementErrorFunction · 0.85

Tested by

no test coverage detected