Skip to content

Commit a8d30fb

Browse files
committed
rename $.space_frag to $.text
1 parent cb7e6bc commit a8d30fb

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,19 +1064,15 @@ function create_block(parent, name, nodes, context) {
10641064
trimmed.every((node) => node.type === 'Text' || node.type === 'ExpressionTag');
10651065

10661066
if (use_space_template) {
1067-
// special case — we can use `$.space_frag` instead of creating a unique template
1067+
// special case — we can use `$.text` instead of creating a unique template
10681068
const id = b.id(context.state.scope.generate('text'));
10691069

10701070
process_children(trimmed, () => id, false, {
10711071
...context,
10721072
state
10731073
});
10741074

1075-
body.push(
1076-
b.var(id, b.call('$.space_frag', b.id('$$anchor'))),
1077-
...state.before_init,
1078-
...state.init
1079-
);
1075+
body.push(b.var(id, b.call('$.text', b.id('$$anchor'))), ...state.before_init, ...state.init);
10801076
close = b.stmt(b.call('$.close', b.id('$$anchor'), id));
10811077
} else {
10821078
/** @type {(is_text: boolean) => import('estree').Expression} */

packages/svelte/src/internal/client/dom/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const comment_template = template('<!>', true);
121121
* @param {Text | Comment | Element} anchor
122122
*/
123123
/*#__NO_SIDE_EFFECTS__*/
124-
export function space_frag(anchor) {
124+
export function text(anchor) {
125125
if (!hydrating) return empty();
126126

127127
var node = hydrate_nodes[0];

packages/svelte/tests/snapshot/samples/each-string-template/_expected/client/index.svelte.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function Each_string_template($$anchor, $$props) {
1111
var node = $.first_child(fragment);
1212

1313
$.each_indexed(node, 1, () => ['foo', 'bar', 'baz'], ($$anchor, thing, $$index) => {
14-
var text = $.space_frag($$anchor);
14+
var text = $.text($$anchor);
1515

1616
$.render_effect(() => $.set_text(text, `${$.stringify($.unwrap(thing))}, `));
1717
return $.close($$anchor, text);

packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/client/index.svelte.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function Function_prop_no_getter($$anchor, $$props) {
2121
onmouseup,
2222
onmouseenter: () => $.set(count, $.proxy(plusOne($.get(count)))),
2323
children: ($$anchor, $$slotProps) => {
24-
var text = $.space_frag($$anchor);
24+
var text = $.text($$anchor);
2525

2626
$.render_effect(() => $.set_text(text, `clicks: ${$.stringify($.get(count))}`));
2727
return $.close($$anchor, text);

0 commit comments

Comments
 (0)