child() — svelte Function Reference
Architecture documentation for the child() function in operations.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8["child()"] 9a9bbc27_46b6_021c_6d77_f736ed4b40f0["operations.js"] eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 -->|defined in| 9a9bbc27_46b6_021c_6d77_f736ed4b40f0 9764bb93_860c_6dee_2112_890b69ee0aa3["create_effect()"] 9764bb93_860c_6dee_2112_890b69ee0aa3 -->|calls| eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 f3bd5a62_2879_ccbe_7046_712cbf9eeaab["get_first_child()"] eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 -->|calls| f3bd5a62_2879_ccbe_7046_712cbf9eeaab ec54e18a_a454_5d8c_9e00_7bc16e4f49c4["create_text()"] eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 -->|calls| ec54e18a_a454_5d8c_9e00_7bc16e4f49c4 40f27ad3_30bb_8f2a_3fb3_757088cf7428["set_hydrate_node()"] eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 -->|calls| 40f27ad3_30bb_8f2a_3fb3_757088cf7428 2471b414_d833_0bea_1bc7_b19c0d8a6d6b["merge_text_nodes()"] eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 -->|calls| 2471b414_d833_0bea_1bc7_b19c0d8a6d6b style eff50a8f_a21b_b3de_5c1d_5f88d6bb5ba8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/operations.js lines 108–131
export function child(node, is_text) {
if (!hydrating) {
return get_first_child(node);
}
var child = get_first_child(hydrate_node);
// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty
if (child === null) {
child = hydrate_node.appendChild(create_text());
} else if (is_text && child.nodeType !== TEXT_NODE) {
var text = create_text();
child?.before(text);
set_hydrate_node(text);
return text;
}
if (is_text) {
merge_text_nodes(/** @type {Text} */ (child));
}
set_hydrate_node(child);
return child;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does child() do?
child() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/operations.js.
Where is child() defined?
child() is defined in packages/svelte/src/internal/client/dom/operations.js at line 108.
What does child() call?
child() calls 4 function(s): create_text, get_first_child, merge_text_nodes, set_hydrate_node.
What calls child()?
child() is called by 1 function(s): create_effect.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free