* Helper function to get the first native node to begin hydrating * the given i18n node.
(lView: LView, node: I18nNode)
| 294 | * the given i18n node. |
| 295 | */ |
| 296 | function getFirstNativeNodeForI18nNode(lView: LView, node: I18nNode) { |
| 297 | const tView = lView[TVIEW]; |
| 298 | const maybeTNode = tView.data[node.index]; |
| 299 | |
| 300 | if (isTNodeShape(maybeTNode)) { |
| 301 | // If the node is backed by an actual TNode, we can simply delegate. |
| 302 | return getFirstNativeNode(lView, maybeTNode); |
| 303 | } else if (node.kind === I18nNodeKind.ICU) { |
| 304 | // A nested ICU container won't have an actual TNode. In that case, we can use |
| 305 | // an iterator to find the first child. |
| 306 | const icuIterator = createIcuIterator(maybeTNode as TIcu, lView); |
| 307 | let rNode: RNode | null = icuIterator(); |
| 308 | |
| 309 | // If the ICU container has no nodes, then we use the ICU anchor as the node. |
| 310 | return rNode ?? unwrapRNode(lView[node.index]); |
| 311 | } else { |
| 312 | // Otherwise, the node is a text or trivial element in an ICU container, |
| 313 | // and we can just use the RNode directly. |
| 314 | return unwrapRNode(lView[node.index]) ?? null; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Describes shared data available during the hydration process. |
no test coverage detected
searching dependent graphs…