Home / Function/ svelte_visitors.IfBlock() — svelte Function Reference

svelte_visitors.IfBlock() — svelte Function Reference

Architecture documentation for the svelte_visitors.IfBlock() function in index.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  49f2cdbc_a434_ac53_67a3_4b06ad38cafd["svelte_visitors.IfBlock()"]
  f0404eed_e134_3c7c_7b38_1cb13c71f197["index.js"]
  49f2cdbc_a434_ac53_67a3_4b06ad38cafd -->|defined in| f0404eed_e134_3c7c_7b38_1cb13c71f197
  139b5520_1d69_2489_cf79_ff7f67682f82["block()"]
  49f2cdbc_a434_ac53_67a3_4b06ad38cafd -->|calls| 139b5520_1d69_2489_cf79_ff7f67682f82
  style 49f2cdbc_a434_ac53_67a3_4b06ad38cafd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/print/index.js lines 599–632

	IfBlock(node, context) {
		if (node.elseif) {
			context.write('{:else if ');
			context.visit(node.test);
			context.write('}');

			block(context, node.consequent);
		} else {
			context.write('{#if ');
			context.visit(node.test);
			context.write('}');

			block(context, node.consequent);
		}

		if (node.alternate !== null) {
			if (
				!(
					node.alternate.nodes.length === 1 &&
					node.alternate.nodes[0].type === 'IfBlock' &&
					node.alternate.nodes[0].elseif
				)
			) {
				context.write('{:else}');
				block(context, node.alternate);
			} else {
				context.visit(node.alternate);
			}
		}

		if (!node.elseif) {
			context.write('{/if}');
		}
	},

Domain

Subdomains

Calls

Frequently Asked Questions

What does svelte_visitors.IfBlock() do?
svelte_visitors.IfBlock() is a function in the svelte codebase, defined in packages/svelte/src/compiler/print/index.js.
Where is svelte_visitors.IfBlock() defined?
svelte_visitors.IfBlock() is defined in packages/svelte/src/compiler/print/index.js at line 599.
What does svelte_visitors.IfBlock() call?
svelte_visitors.IfBlock() calls 1 function(s): block.

Analyze Your Own Codebase

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

Try Supermodel Free