MCPcopy
hub / github.com/livebud/bud / add_element

Method add_element

package/svelte/compiler.js:14447–14462  ·  view source on GitHub ↗
(id2, render_statement, claim_statement, parent_node, no_detach)

Source from the content-addressed store, hash-verified

14445 }
14446 }
14447 add_element(id2, render_statement, claim_statement, parent_node, no_detach) {
14448 this.add_variable(id2);
14449 this.chunks.create.push(b`${id2} = ${render_statement};`);
14450 if (this.renderer.options.hydratable) {
14451 this.chunks.claim.push(b`${id2} = ${claim_statement || render_statement};`);
14452 }
14453 if (parent_node) {
14454 this.chunks.mount.push(b`@append(${parent_node}, ${id2});`);
14455 if (is_head(parent_node) && !no_detach)
14456 this.chunks.destroy.push(b`@detach(${id2});`);
14457 } else {
14458 this.chunks.mount.push(b`@insert(#target, ${id2}, #anchor);`);
14459 if (!no_detach)
14460 this.chunks.destroy.push(b`if (detaching) @detach(${id2});`);
14461 }
14462 }
14463 add_intro(local) {
14464 this.has_intros = this.has_intro_method = true;
14465 if (!local && this.parent)

Callers 3

get_or_create_anchorMethod · 0.80
renderMethod · 0.80
render_keyedMethod · 0.80

Calls 4

bFunction · 0.85
is_headFunction · 0.85
add_variableMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected