sibling() — svelte Function Reference
Architecture documentation for the sibling() function in operations.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 02445d40_4bf4_0107_e7cd_79455afdd781["sibling()"] 9a9bbc27_46b6_021c_6d77_f736ed4b40f0["operations.js"] 02445d40_4bf4_0107_e7cd_79455afdd781 -->|defined in| 9a9bbc27_46b6_021c_6d77_f736ed4b40f0 4776c976_30bb_448d_921d_ee70a7fa0135["get_next_sibling()"] 02445d40_4bf4_0107_e7cd_79455afdd781 -->|calls| 4776c976_30bb_448d_921d_ee70a7fa0135 ec54e18a_a454_5d8c_9e00_7bc16e4f49c4["create_text()"] 02445d40_4bf4_0107_e7cd_79455afdd781 -->|calls| ec54e18a_a454_5d8c_9e00_7bc16e4f49c4 40f27ad3_30bb_8f2a_3fb3_757088cf7428["set_hydrate_node()"] 02445d40_4bf4_0107_e7cd_79455afdd781 -->|calls| 40f27ad3_30bb_8f2a_3fb3_757088cf7428 2471b414_d833_0bea_1bc7_b19c0d8a6d6b["merge_text_nodes()"] 02445d40_4bf4_0107_e7cd_79455afdd781 -->|calls| 2471b414_d833_0bea_1bc7_b19c0d8a6d6b style 02445d40_4bf4_0107_e7cd_79455afdd781 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/operations.js lines 173–208
export function sibling(node, count = 1, is_text = false) {
let next_sibling = hydrating ? hydrate_node : node;
var last_sibling;
while (count--) {
last_sibling = next_sibling;
next_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));
}
if (!hydrating) {
return next_sibling;
}
if (is_text) {
// if a sibling {expression} is empty during SSR, there might be no
// text node to hydrate — we must therefore create one
if (next_sibling?.nodeType !== TEXT_NODE) {
var text = create_text();
// If the next sibling is `null` and we're handling text then it's because
// the SSR content was empty for the text, so we need to generate a new text
// node and insert it after the last sibling
if (next_sibling === null) {
last_sibling?.after(text);
} else {
next_sibling.before(text);
}
set_hydrate_node(text);
return text;
}
merge_text_nodes(/** @type {Text} */ (next_sibling));
}
set_hydrate_node(next_sibling);
return next_sibling;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does sibling() do?
sibling() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/operations.js.
Where is sibling() defined?
sibling() is defined in packages/svelte/src/internal/client/dom/operations.js at line 173.
What does sibling() call?
sibling() calls 4 function(s): create_text, get_next_sibling, merge_text_nodes, set_hydrate_node.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free