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

Function insertCorruptedTextNodeMarkers

packages/core/src/hydration/annotate.ts:869–876  ·  view source on GitHub ↗

* Physically inserts the comment nodes to ensure empty text nodes and adjacent * text node separators are preserved after server serialization of the DOM. * These get swapped back for empty text nodes or separators once hydration happens * on the client. * * @param corruptedTextNodes The Map of

(
  corruptedTextNodes: Map<HTMLElement, string>,
  doc: Document,
)

Source from the content-addressed store, hash-verified

867 * @param doc The document
868 */
869function insertCorruptedTextNodeMarkers(
870 corruptedTextNodes: Map<HTMLElement, string>,
871 doc: Document,
872) {
873 for (const [textNode, marker] of corruptedTextNodes) {
874 textNode.after(doc.createComment(marker));
875 }
876}
877
878/**
879 * Detects whether a given TNode represents a node that

Callers 1

annotateForHydrationFunction · 0.85

Calls 1

createCommentMethod · 0.65

Tested by

no test coverage detected