MCPcopy
hub / github.com/angular/angular / appendSsrContentIntegrityMarker

Function appendSsrContentIntegrityMarker

packages/platform-server/src/utils.ts:133–139  ·  view source on GitHub ↗

* Creates a marker comment node and append it into the ` `. * Some CDNs have mechanisms to remove all comment node from HTML. * This behaviour breaks hydration, so we'll detect on the client side if this * marker comment is still available or else throw an error

(doc: Document)

Source from the content-addressed store, hash-verified

131 * marker comment is still available or else throw an error
132 */
133function appendSsrContentIntegrityMarker(doc: Document) {
134 // Adding a ng hydration marker comment
135 const comment = doc.createComment(SSR_CONTENT_INTEGRITY_MARKER);
136 doc.body.firstChild
137 ? doc.body.insertBefore(comment, doc.body.firstChild)
138 : doc.body.append(comment);
139}
140
141/**
142 * Adds the `ng-server-context` attribute to host elements of all bootstrapped components

Callers 1

prepareForHydrationFunction · 0.85

Calls 3

createCommentMethod · 0.65
insertBeforeMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…