from_namespace() — svelte Function Reference
Architecture documentation for the from_namespace() function in template.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 02d6517a_7127_1fec_c75c_a4526255c257["from_namespace()"] 2ab7c579_f011_f472_7847_c9e9979c6b2a["template.js"] 02d6517a_7127_1fec_c75c_a4526255c257 -->|defined in| 2ab7c579_f011_f472_7847_c9e9979c6b2a 1e129bee_787b_368a_dcf2_35e06ce0f006["from_svg()"] 1e129bee_787b_368a_dcf2_35e06ce0f006 -->|calls| 02d6517a_7127_1fec_c75c_a4526255c257 36f9a58e_c4b4_2694_a6e9_9243df6d11c7["from_mathml()"] 36f9a58e_c4b4_2694_a6e9_9243df6d11c7 -->|calls| 02d6517a_7127_1fec_c75c_a4526255c257 e23e5c5c_05b1_afa5_e280_5c89012b55a7["assign_nodes()"] 02d6517a_7127_1fec_c75c_a4526255c257 -->|calls| e23e5c5c_05b1_afa5_e280_5c89012b55a7 0fd60e7d_ad18_dc03_875d_13156cdee4b4["create_fragment_from_html()"] 02d6517a_7127_1fec_c75c_a4526255c257 -->|calls| 0fd60e7d_ad18_dc03_875d_13156cdee4b4 f3bd5a62_2879_ccbe_7046_712cbf9eeaab["get_first_child()"] 02d6517a_7127_1fec_c75c_a4526255c257 -->|calls| f3bd5a62_2879_ccbe_7046_712cbf9eeaab style 02d6517a_7127_1fec_c75c_a4526255c257 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/template.js lines 92–138
function from_namespace(content, flags, ns = 'svg') {
/**
* 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('<!>');
var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;
var wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;
/** @type {Element | DocumentFragment} */
var node;
return () => {
if (hydrating) {
assign_nodes(hydrate_node, null);
return hydrate_node;
}
if (!node) {
var fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));
var root = /** @type {Element} */ (get_first_child(fragment));
if (is_fragment) {
node = document.createDocumentFragment();
while (get_first_child(root)) {
node.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));
}
} else {
node = /** @type {Element} */ (get_first_child(root));
}
}
var clone = /** @type {TemplateNode} */ (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
Called By
Source
Frequently Asked Questions
What does from_namespace() do?
from_namespace() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/template.js.
Where is from_namespace() defined?
from_namespace() is defined in packages/svelte/src/internal/client/dom/template.js at line 92.
What does from_namespace() call?
from_namespace() calls 3 function(s): assign_nodes, create_fragment_from_html, get_first_child.
What calls from_namespace()?
from_namespace() is called by 2 function(s): from_mathml, from_svg.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free