Home / Function/ comment() — svelte Function Reference

comment() — svelte Function Reference

Architecture documentation for the comment() function in template.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  51b89fea_28f7_fbcf_548b_82970d1c16f9["comment()"]
  2ab7c579_f011_f472_7847_c9e9979c6b2a["template.js"]
  51b89fea_28f7_fbcf_548b_82970d1c16f9 -->|defined in| 2ab7c579_f011_f472_7847_c9e9979c6b2a
  e23e5c5c_05b1_afa5_e280_5c89012b55a7["assign_nodes()"]
  51b89fea_28f7_fbcf_548b_82970d1c16f9 -->|calls| e23e5c5c_05b1_afa5_e280_5c89012b55a7
  ec54e18a_a454_5d8c_9e00_7bc16e4f49c4["create_text()"]
  51b89fea_28f7_fbcf_548b_82970d1c16f9 -->|calls| ec54e18a_a454_5d8c_9e00_7bc16e4f49c4
  e3f9d623_9f97_2d01_0473_63e757414179["append()"]
  51b89fea_28f7_fbcf_548b_82970d1c16f9 -->|calls| e3f9d623_9f97_2d01_0473_63e757414179
  style 51b89fea_28f7_fbcf_548b_82970d1c16f9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/dom/template.js lines 326–341

export function comment() {
	// we're not delegating to `template` here for performance reasons
	if (hydrating) {
		assign_nodes(hydrate_node, null);
		return hydrate_node;
	}

	var frag = document.createDocumentFragment();
	var start = document.createComment('');
	var anchor = create_text();
	frag.append(start, anchor);

	assign_nodes(start, anchor);

	return frag;
}

Domain

Subdomains

Frequently Asked Questions

What does comment() do?
comment() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/template.js.
Where is comment() defined?
comment() is defined in packages/svelte/src/internal/client/dom/template.js at line 326.
What does comment() call?
comment() calls 3 function(s): append, assign_nodes, create_text.

Analyze Your Own Codebase

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

Try Supermodel Free