File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/svelte/src/compiler/phases/3-transform/client/visitors Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -353,10 +353,12 @@ export function RegularElement(node, context) {
353353
354354 // special case — if an element that only contains text, we don't need
355355 // to descend into it if the text is non-reactive
356- const states_and_calls =
356+ // in the rare case that we have static text that can't be inlined
357+ // (e.g. `<span>{location}</span>`), set `textContent` programmatically
358+ const use_text_content =
357359 trimmed . every ( ( node ) => node . type === 'Text' || node . type === 'ExpressionTag' ) &&
358- trimmed . some ( ( node ) => node . type === 'ExpressionTag' ) &&
359- get_states_and_calls ( trimmed ) ;
360+ trimmed . every ( ( node ) => node . type === 'Text' || ! node . metadata . expression . has_state ) &&
361+ trimmed . some ( ( node ) => node . type === 'ExpressionTag' ) ;
360362
361363 if ( states_and_calls && states_and_calls . states === 0 ) {
362364 child_state . init . push (
You can’t perform that action at this time.
0 commit comments