MCPcopy Index your code
hub / github.com/angular/angular / traverseNextElement

Function traverseNextElement

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

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

(tNode: TNode)

Source from the content-addressed store, hash-verified

245 * Locates the next tNode (child, sibling or parent).
246 */
247function traverseNextElement(tNode: TNode): TNode | null {
248 if (tNode.child) {
249 return tNode.child;
250 } else if (tNode.next) {
251 return tNode.next;
252 } else {
253 // Let's take the following template: <div><span>text</span></div><component/>
254 // After checking the text node, we need to find the next parent that has a "next" TNode,
255 // in this case the parent `div`, so that we can find the component.
256 while (tNode.parent && !tNode.parent.next) {
257 tNode = tNode.parent;
258 }
259 return tNode.parent && tNode.parent.next;
260 }
261}
262
263/**
264 * 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…