MCPcopy Create free account
hub / github.com/angular/angular / getLNodeForHydration

Function getLNodeForHydration

packages/core/src/hydration/utils.ts:232–248  ·  view source on GitHub ↗
(viewRef: ViewRef)

Source from the content-addressed store, hash-verified

230 * - `null` in case of an embedded view
231 */
232export function getLNodeForHydration(viewRef: ViewRef): LView | LContainer | null {
233 // Reading an internal field from `ViewRef` instance.
234 let lView = (viewRef as any)._lView as LView;
235 const tView = lView[TVIEW];
236 // A registered ViewRef might represent an instance of an
237 // embedded view, in which case we do not need to annotate it.
238 if (tView.type === TViewType.Embedded) {
239 return null;
240 }
241 // Check if it's a root view and if so, retrieve component's
242 // LView from the first slot after the header.
243 if (isRootView(lView)) {
244 lView = lView[HEADER_OFFSET];
245 }
246
247 return lView;
248}
249
250function getTextNodeContent(node: Node): string | undefined {
251 return node.textContent?.replace(/\s/gm, '');

Callers 2

annotateForHydrationFunction · 0.90
cleanupDehydratedViewsFunction · 0.90

Calls 1

isRootViewFunction · 0.90

Tested by

no test coverage detected