from_tree() — svelte Function Reference
Architecture documentation for the from_tree() function in template.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 7232e4f4_c61f_9ad7_a651_1b6fdca3a287["from_tree()"] 2ab7c579_f011_f472_7847_c9e9979c6b2a["template.js"] 7232e4f4_c61f_9ad7_a651_1b6fdca3a287 -->|defined in| 2ab7c579_f011_f472_7847_c9e9979c6b2a e23e5c5c_05b1_afa5_e280_5c89012b55a7["assign_nodes()"] 7232e4f4_c61f_9ad7_a651_1b6fdca3a287 -->|calls| e23e5c5c_05b1_afa5_e280_5c89012b55a7 9377bbc7_f1f5_56f6_87e1_cfa79859a6b7["fragment_from_tree()"] 7232e4f4_c61f_9ad7_a651_1b6fdca3a287 -->|calls| 9377bbc7_f1f5_56f6_87e1_cfa79859a6b7 f3bd5a62_2879_ccbe_7046_712cbf9eeaab["get_first_child()"] 7232e4f4_c61f_9ad7_a651_1b6fdca3a287 -->|calls| f3bd5a62_2879_ccbe_7046_712cbf9eeaab style 7232e4f4_c61f_9ad7_a651_1b6fdca3a287 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/template.js lines 210–250
export function from_tree(structure, flags) {
var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;
var use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;
/** @type {Node} */
var node;
return () => {
if (hydrating) {
assign_nodes(hydrate_node, null);
return hydrate_node;
}
if (node === undefined) {
const ns =
(flags & TEMPLATE_USE_SVG) !== 0
? NAMESPACE_SVG
: (flags & TEMPLATE_USE_MATHML) !== 0
? NAMESPACE_MATHML
: undefined;
node = fragment_from_tree(structure, ns);
if (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));
}
var clone = /** @type {TemplateNode} */ (
use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)
);
if (is_fragment) {
var start = /** @type {TemplateNode} */ (get_first_child(clone));
var end = /** @type {TemplateNode} */ (clone.lastChild);
assign_nodes(start, end);
} else {
assign_nodes(clone, clone);
}
return clone;
};
}
Domain
Subdomains
Source
Frequently Asked Questions
What does from_tree() do?
from_tree() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/template.js.
Where is from_tree() defined?
from_tree() is defined in packages/svelte/src/internal/client/dom/template.js at line 210.
What does from_tree() call?
from_tree() calls 3 function(s): assign_nodes, fragment_from_tree, get_first_child.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free