Home / Function/ normalize_html() — svelte Function Reference

normalize_html() — svelte Function Reference

Architecture documentation for the normalize_html() function in assert.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  e2c721f4_c907_b96e_684b_444f841adea2["normalize_html()"]
  2a2d28a9_d1e5_6b47_9375_279552e7c7f8["assert.js"]
  e2c721f4_c907_b96e_684b_444f841adea2 -->|defined in| 2a2d28a9_d1e5_6b47_9375_279552e7c7f8
  4b6f72d5_8908_7410_71ee_78d06484a92f["htmlEqual()"]
  4b6f72d5_8908_7410_71ee_78d06484a92f -->|calls| e2c721f4_c907_b96e_684b_444f841adea2
  b5d50997_2063_87fb_f6c6_de871718d37b["normalize_children()"]
  e2c721f4_c907_b96e_684b_444f841adea2 -->|calls| b5d50997_2063_87fb_f6c6_de871718d37b
  style e2c721f4_c907_b96e_684b_444f841adea2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/tests/runtime-browser/assert.js lines 71–86

function normalize_html(window, html) {
	try {
		const node = window.document.createElement('div');
		node.innerHTML = html
			.replace(/<!--.*?-->/g, '')
			.replace(/>[\s\r\n]+</g, '><')
			.replace(/svelte-\w+/g, 'svelte-xyz123')
			.trim();

		normalize_children(node);

		return node.innerHTML.replace(/<\/?noscript\/?>/g, '');
	} catch (err) {
		throw new Error(`Failed to normalize HTML:\n${html}`);
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does normalize_html() do?
normalize_html() is a function in the svelte codebase, defined in packages/svelte/tests/runtime-browser/assert.js.
Where is normalize_html() defined?
normalize_html() is defined in packages/svelte/tests/runtime-browser/assert.js at line 71.
What does normalize_html() call?
normalize_html() calls 1 function(s): normalize_children.
What calls normalize_html()?
normalize_html() is called by 1 function(s): htmlEqual.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free