Skip to content

Commit cb75b5c

Browse files
authored
chore: minor tidy up (#12889)
1 parent 19a35c6 commit cb75b5c

File tree

1 file changed

+5
-7
lines changed
  • packages/svelte/src/compiler/phases/3-transform/client/visitors/shared

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,23 @@ export function process_children(nodes, expression, is_element, { visit, state }
3636
}
3737
}
3838

39-
const text_id = get_node_id(expression(true), state, 'text');
39+
const id = get_node_id(expression(true), state, 'text');
4040

4141
state.template.push(' ');
4242

4343
const { has_state, has_call, value } = build_template_literal(sequence, visit, state);
4444

45-
const update = b.stmt(b.call('$.set_text', text_id, value));
45+
const update = b.stmt(b.call('$.set_text', id, value));
4646

4747
if (has_call && !within_bound_contenteditable) {
4848
state.init.push(build_update(update));
4949
} else if (has_state && !within_bound_contenteditable) {
5050
state.update.push(update);
5151
} else {
52-
state.init.push(b.stmt(b.assignment('=', b.member(text_id, b.id('nodeValue')), value)));
52+
state.init.push(b.stmt(b.assignment('=', b.member(id, b.id('nodeValue')), value)));
5353
}
5454

55-
expression = (is_text) =>
56-
is_text ? b.call('$.sibling', text_id, b.true) : b.call('$.sibling', text_id);
55+
expression = (is_text) => b.call('$.sibling', id, is_text && b.true);
5756
}
5857

5958
for (let i = 0; i < nodes.length; i += 1) {
@@ -87,8 +86,7 @@ export function process_children(nodes, expression, is_element, { visit, state }
8786
node.type === 'RegularElement' ? node.name : 'node'
8887
);
8988

90-
expression = (is_text) =>
91-
is_text ? b.call('$.sibling', id, b.true) : b.call('$.sibling', id);
89+
expression = (is_text) => b.call('$.sibling', id, is_text && b.true);
9290

9391
visit(node, {
9492
...state,

0 commit comments

Comments
 (0)