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

Function locateRNodeByPath

packages/core/src/hydration/node_lookup_utils.ts:242–256  ·  view source on GitHub ↗

* Locates an RNode given a set of navigation instructions (which also contains * a starting point node info).

(path: string, lView: LView)

Source from the content-addressed store, hash-verified

240 * a starting point node info).
241 */
242function locateRNodeByPath(path: string, lView: LView): RNode {
243 const [referenceNode, ...navigationInstructions] = decompressNodeLocation(path);
244 let ref: Element;
245 if (referenceNode === REFERENCE_NODE_HOST) {
246 ref = lView[DECLARATION_COMPONENT_VIEW][HOST] as unknown as Element;
247 } else if (referenceNode === REFERENCE_NODE_BODY) {
248 ref = ɵɵresolveBody(
249 lView[DECLARATION_COMPONENT_VIEW][HOST] as RElement & {ownerDocument: Document},
250 ) as Element;
251 } else {
252 const parentElementId = Number(referenceNode);
253 ref = unwrapRNode((lView as any)[parentElementId + HEADER_OFFSET]) as Element;
254 }
255 return navigateToNode(ref, navigationInstructions);
256}
257
258/**
259 * Generate a list of DOM navigation operations to get from node `start` to node `finish`.

Callers 2

tryLocateRNodeByPathFunction · 0.85
locateNextRNodeFunction · 0.85

Calls 4

decompressNodeLocationFunction · 0.90
ɵɵresolveBodyFunction · 0.90
unwrapRNodeFunction · 0.90
navigateToNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…