fix: improve ssr template literal generation (#10127)

pull/10128/head
Dominic Gannaway 11 months ago committed by GitHub
parent cd2263fdab
commit 901cfc9f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: improve ssr template literal generation

@ -705,7 +705,7 @@ function serialize_attribute_value(
/** @type {import('estree').Expression} */ (context.visit(node.expression)) /** @type {import('estree').Expression} */ (context.visit(node.expression))
) )
); );
if (i === attribute_value.length) { if (i === attribute_value.length || attribute_value[i]?.type !== 'Text') {
quasis.push(b.quasi('', true)); quasis.push(b.quasi('', true));
} }
} }

@ -0,0 +1,6 @@
import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
html: `<div class="123"></div><img src="12 hello, world 13">`
});

@ -0,0 +1,9 @@
<script>
let a = 1;
let b = 2;
let c = 3;
</script>
<div class="{a}{b}{c}" />
<img src="{a}{b} hello, world {a}{c}" />
Loading…
Cancel
Save