Home / Function/ SvelteFragment() — svelte Function Reference

SvelteFragment() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  aa41b09d_e55c_ecda_de33_e201a39ef960["SvelteFragment()"]
  f2ad80e0_97e0_ac48_aec8_8b70c646ca26["SvelteFragment.js"]
  aa41b09d_e55c_ecda_de33_e201a39ef960 -->|defined in| f2ad80e0_97e0_ac48_aec8_8b70c646ca26
  7969f2e0_ceec_b446_cab9_705ba17f8d8a["svelte_fragment_invalid_placement()"]
  aa41b09d_e55c_ecda_de33_e201a39ef960 -->|calls| 7969f2e0_ceec_b446_cab9_705ba17f8d8a
  c3969ef3_0f9b_1699_e3b6_75b4a9916c7d["validate_slot_attribute()"]
  aa41b09d_e55c_ecda_de33_e201a39ef960 -->|calls| c3969ef3_0f9b_1699_e3b6_75b4a9916c7d
  f86f9d49_45a5_0bbd_d79b_5ce20b9f8c1b["svelte_fragment_invalid_attribute()"]
  aa41b09d_e55c_ecda_de33_e201a39ef960 -->|calls| f86f9d49_45a5_0bbd_d79b_5ce20b9f8c1b
  style aa41b09d_e55c_ecda_de33_e201a39ef960 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/2-analyze/visitors/SvelteFragment.js lines 10–27

export function SvelteFragment(node, context) {
	const parent = context.path.at(-2);
	if (parent?.type !== 'Component' && parent?.type !== 'SvelteComponent') {
		e.svelte_fragment_invalid_placement(node);
	}

	for (const attribute of node.attributes) {
		if (attribute.type === 'Attribute') {
			if (attribute.name === 'slot') {
				validate_slot_attribute(context, attribute);
			}
		} else if (attribute.type !== 'LetDirective') {
			e.svelte_fragment_invalid_attribute(attribute);
		}
	}

	context.next({ ...context.state, parent_element: null });
}

Domain

Subdomains

Frequently Asked Questions

What does SvelteFragment() do?
SvelteFragment() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/SvelteFragment.js.
Where is SvelteFragment() defined?
SvelteFragment() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/SvelteFragment.js at line 10.
What does SvelteFragment() call?
SvelteFragment() calls 3 function(s): svelte_fragment_invalid_attribute, svelte_fragment_invalid_placement, validate_slot_attribute.

Analyze Your Own Codebase

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

Try Supermodel Free