MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / insertSafeHtml

Function insertSafeHtml

src/patch-streaming-html.ts:14–20  ·  view source on GitHub ↗

Sanitize before every incremental DOM write during streaming

(
  parent: Element,
  position: InsertPosition,
  html: string,
)

Source from the content-addressed store, hash-verified

12
13/** Sanitize before every incremental DOM write during streaming */
14function insertSafeHtml(
15 parent: Element,
16 position: InsertPosition,
17 html: string,
18): void {
19 parent.insertAdjacentHTML(position, sanitizePatchFragment(html));
20}
21
22/** DOMPurify strips bare tr/td — wrap in table context first */
23function sanitizePatchFragment(html: string): string {

Callers 2

promoteOrAppendRowsFunction · 0.85
patchPartialRowInSectionFunction · 0.85

Calls 1

sanitizePatchFragmentFunction · 0.85

Tested by

no test coverage detected