pull/9601/head
Rich Harris 3 years ago
parent 5a8cbbfbd1
commit 2b8106654f

@ -1037,18 +1037,10 @@ function create_block(parent, name, nodes, context) {
const template = state.template[0];
if (state.template.length === 1 && (template === ' ' || template === '<!>')) {
const template_name = b.id(template === ' ' ? '$.space' : '$.comment');
const callee = b.id(template === ' ' ? '$.space' : '$.comment');
body.push(
b.var(
id,
b.call(
'$.open_frag',
b.id('$$anchor'),
b.literal(!state.metadata.template_needs_import_node),
template_name
)
),
b.var(id, b.call(callee, b.id('$$anchor'))),
b.var(node_id, b.call('$.child_frag', id)),
...state.init
);

@ -134,7 +134,7 @@ export function svg_replace(node) {
* @param {boolean} is_fragment
* @param {boolean} use_clone_node
* @param {null | Text | Comment | Element} anchor
* @param {() => Element} [template_element_fn]
* @param {() => Node} [template_element_fn]
* @returns {Element | DocumentFragment | Node[]}
*/
function open_template(is_fragment, use_clone_node, anchor, template_element_fn) {
@ -168,7 +168,7 @@ export function open(anchor, use_clone_node, template_element_fn) {
/**
* @param {null | Text | Comment | Element} anchor
* @param {boolean} use_clone_node
* @param {() => Element} [template_element_fn]
* @param {() => Node} [template_element_fn]
* @returns {Element | DocumentFragment | Node[]}
*/
/*#__NO_SIDE_EFFECTS__*/
@ -176,8 +176,24 @@ export function open_frag(anchor, use_clone_node, template_element_fn) {
return open_template(true, use_clone_node, anchor, template_element_fn);
}
export const space = template(' ', true);
export const comment = template('<!>', true);
const space_template = template(' ', true);
const comment_template = template('<!>', true);
/**
* @param {null | Text | Comment | Element} anchor
*/
/*#__NO_SIDE_EFFECTS__*/
export function space(anchor) {
return open_frag(anchor, true, space_template);
}
/**
* @param {null | Text | Comment | Element} anchor
*/
/*#__NO_SIDE_EFFECTS__*/
export function comment(anchor) {
return open_frag(anchor, true, comment_template);
}
/**
* @param {Element | Text} dom

@ -1,4 +1,4 @@
// index.svelte (Svelte VERSION)
// index.svelte (Svelte v5.0.0-next.9)
// Note: compiler output will change before 5.0 is released!
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal";
@ -13,7 +13,7 @@ export default function Function_prop_no_getter($$anchor, $$props) {
}
/* Init */
var fragment = $.open_frag($$anchor, true, $.comment);
var fragment = $.comment($$anchor);
var node = $.child_frag(fragment);
Button(node, {
@ -21,7 +21,7 @@ export default function Function_prop_no_getter($$anchor, $$props) {
onmouseup,
children: ($$anchor, $$slotProps) => {
/* Init */
var fragment_1 = $.open_frag($$anchor, true, $.space);
var fragment_1 = $.space($$anchor);
var node_1 = $.child_frag(fragment_1);
/* Update */

Loading…
Cancel
Save