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

Function traverseNextElement

packages/core/src/render3/context_discovery.ts:231–245  ·  view source on GitHub ↗

* Locates the next tNode (child, sibling or parent).

(tNode: TNode)

Source from the content-addressed store, hash-verified

229 * Locates the next tNode (child, sibling or parent).
230 */
231function traverseNextElement(tNode: TNode): TNode | null {
232 if (tNode.child) {
233 return tNode.child;
234 } else if (tNode.next) {
235 return tNode.next;
236 } else {
237 // Let's take the following template: <div><span>text</span></div><component/>
238 // After checking the text node, we need to find the next parent that has a "next" TNode,
239 // in this case the parent `div`, so that we can find the component.
240 while (tNode.parent && !tNode.parent.next) {
241 tNode = tNode.parent;
242 }
243 return tNode.parent && tNode.parent.next;
244 }
245}
246
247/**
248 * Locates the component within the given LView and returns the matching index

Callers 1

findViaDirectiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected