Home / Function/ find_descendants() — svelte Function Reference

find_descendants() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  d0be0ead_0b19_a473_e266_d33ce595c91b["find_descendants()"]
  bbca3d2a_42c8_b215_d3b5_5077ccaf0797["nodes.js"]
  d0be0ead_0b19_a473_e266_d33ce595c91b -->|defined in| bbca3d2a_42c8_b215_d3b5_5077ccaf0797
  02aa96ac_ad32_58cd_41f5_e0ee1020af5f["is_customizable_select_element()"]
  02aa96ac_ad32_58cd_41f5_e0ee1020af5f -->|calls| d0be0ead_0b19_a473_e266_d33ce595c91b
  style d0be0ead_0b19_a473_e266_d33ce595c91b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/nodes.js lines 212–258

function* find_descendants(fragment) {
	if (fragment === null) return;

	for (const node of fragment.nodes) {
		switch (node.type) {
			case 'SnippetBlock':
			case 'DebugTag':
			case 'ConstTag':
			case 'Comment':
			case 'ExpressionTag':
				break;

			case 'Text':
				if (node.data.trim() !== '') {
					yield node;
				}
				break;

			case 'IfBlock':
				yield* find_descendants(node.consequent);
				yield* find_descendants(node.alternate);
				break;

			case 'EachBlock':
				yield* find_descendants(node.body);
				yield* find_descendants(node.fallback ?? null);
				break;

			case 'KeyBlock':
				yield* find_descendants(node.fragment);
				break;

			case 'AwaitBlock':
				yield* find_descendants(node.pending);
				yield* find_descendants(node.then);
				yield* find_descendants(node.catch);
				break;

			case 'SvelteBoundary':
				yield* find_descendants(node.fragment);
				break;

			default:
				yield node;
		}
	}
}

Domain

Subdomains

Frequently Asked Questions

What does find_descendants() do?
find_descendants() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/nodes.js.
Where is find_descendants() defined?
find_descendants() is defined in packages/svelte/src/compiler/phases/nodes.js at line 212.
What calls find_descendants()?
find_descendants() is called by 1 function(s): is_customizable_select_element.

Analyze Your Own Codebase

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

Try Supermodel Free