Skip to content

Commit 785f60d

Browse files
committed
explain what is happening
1 parent c5e3548 commit 785f60d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ export function RegularElement(node, context) {
356356
// special case — if an element that only contains text, we don't need
357357
// to descend into it if the text is non-reactive
358358
const is_text = trimmed.every((node) => node.type === 'Text' || node.type === 'ExpressionTag');
359+
360+
// in the rare case that we have static text that can't be inlined
361+
// (e.g. `<span>{location}</span>`), set `textContent` programmatically
359362
const use_text_content =
360363
is_text &&
361364
trimmed.every((node) => node.type === 'Text' || !node.metadata.expression.has_state) &&

0 commit comments

Comments
 (0)