* Locates an RNode given a set of navigation instructions (which also contains * a starting point node info).
(path: string, lView: LView)
| 272 | * a starting point node info). |
| 273 | */ |
| 274 | function locateRNodeByPath(path: string, lView: LView): RNode { |
| 275 | const [referenceNode, ...navigationInstructions] = decompressNodeLocation(path); |
| 276 | let ref: Element; |
| 277 | if (referenceNode === REFERENCE_NODE_HOST) { |
| 278 | ref = lView[DECLARATION_COMPONENT_VIEW][HOST] as unknown as Element; |
| 279 | } else if (referenceNode === REFERENCE_NODE_BODY) { |
| 280 | ref = ɵɵresolveBody( |
| 281 | lView[DECLARATION_COMPONENT_VIEW][HOST] as RElement & {ownerDocument: Document}, |
| 282 | ) as Element; |
| 283 | } else { |
| 284 | const parentElementId = Number(referenceNode); |
| 285 | ref = unwrapRNode((lView as any)[parentElementId + HEADER_OFFSET]) as Element; |
| 286 | } |
| 287 | return navigateToNode(ref, navigationInstructions); |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * Generate a list of DOM navigation operations to get from node `start` to node `finish`. |
no test coverage detected