MCPcopy
hub / github.com/angular/angular / findViaNativeElement

Function findViaNativeElement

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

* Locates the element within the given LView and returns the matching index

(lView: LView, target: RElement)

Source from the content-addressed store, hash-verified

231 * Locates the element within the given LView and returns the matching index
232 */
233function findViaNativeElement(lView: LView, target: RElement): number {
234 const tView = lView[TVIEW];
235 for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
236 if (unwrapRNode(lView[i]) === target) {
237 return i;
238 }
239 }
240
241 return -1;
242}
243
244/**
245 * Locates the next tNode (child, sibling or parent).

Callers 1

getLContextFunction · 0.85

Calls 1

unwrapRNodeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…