MCPcopy
hub / github.com/sveltejs/svelte / normalize_html

Function normalize_html

packages/svelte/tests/html_equal.js:122–133  ·  view source on GitHub ↗
(window, html, { preserveComments = false } = {})

Source from the content-addressed store, hash-verified

120 * @param {{ preserveComments?: boolean }} opts
121 */
122export function normalize_html(window, html, { preserveComments = false } = {}) {
123 try {
124 const node = window.document.createElement('div');
125
126 node.innerHTML = html.trim();
127 clean_children(node, { preserveComments });
128
129 return node.innerHTML;
130 } catch (err) {
131 throw new Error(`Failed to normalize HTML:\n${html}\nCause: ${err}`);
132 }
133}
134
135/**
136 * @param {string} html

Callers 2

assert_html_equalFunction · 0.70

Calls 1

clean_childrenFunction · 0.85

Tested by

no test coverage detected