from_html() — svelte Function Reference
Architecture documentation for the from_html() function in template.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD be8ac17f_8ff0_196f_1c5e_e8600e2a1744["from_html()"] 2ab7c579_f011_f472_7847_c9e9979c6b2a["template.js"] be8ac17f_8ff0_196f_1c5e_e8600e2a1744 -->|defined in| 2ab7c579_f011_f472_7847_c9e9979c6b2a e23e5c5c_05b1_afa5_e280_5c89012b55a7["assign_nodes()"] be8ac17f_8ff0_196f_1c5e_e8600e2a1744 -->|calls| e23e5c5c_05b1_afa5_e280_5c89012b55a7 0fd60e7d_ad18_dc03_875d_13156cdee4b4["create_fragment_from_html()"] be8ac17f_8ff0_196f_1c5e_e8600e2a1744 -->|calls| 0fd60e7d_ad18_dc03_875d_13156cdee4b4 f3bd5a62_2879_ccbe_7046_712cbf9eeaab["get_first_child()"] be8ac17f_8ff0_196f_1c5e_e8600e2a1744 -->|calls| f3bd5a62_2879_ccbe_7046_712cbf9eeaab style be8ac17f_8ff0_196f_1c5e_e8600e2a1744 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/template.js lines 44–83
export function from_html(content, flags) {
var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;
var use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;
/** @type {Node} */
var node;
/**
* Whether or not the first item is a text/element node. If not, we need to
* create an additional comment node to act as `effect.nodes.start`
*/
var has_start = !content.startsWith('<!>');
return () => {
if (hydrating) {
assign_nodes(hydrate_node, null);
return hydrate_node;
}
if (node === undefined) {
node = create_fragment_from_html(has_start ? content : '<!>' + content);
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_html() do?
from_html() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/template.js.
Where is from_html() defined?
from_html() is defined in packages/svelte/src/internal/client/dom/template.js at line 44.
What does from_html() call?
from_html() calls 3 function(s): assign_nodes, create_fragment_from_html, get_first_child.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free