mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
fix escaping of sigils in component attribute values in SSR
This commit is contained in:
parent
0ef8229077
commit
132901bbe7
@ -6,7 +6,7 @@ import { AppendTarget } from '../interfaces';
|
||||
import { Node } from '../../../interfaces';
|
||||
import getObject from '../../../utils/getObject';
|
||||
import getTailSnippet from '../../../utils/getTailSnippet';
|
||||
import { stringify } from '../../../utils/stringify';
|
||||
import { escape, stringify } from '../../../utils/stringify';
|
||||
|
||||
export default function visitComponent(
|
||||
generator: SsrGenerator,
|
||||
@ -14,7 +14,7 @@ export default function visitComponent(
|
||||
node: Node
|
||||
) {
|
||||
function stringifyAttribute(chunk: Node) {
|
||||
if (chunk.type === 'Text') return chunk.data;
|
||||
if (chunk.type === 'Text') return escape(chunk.data);
|
||||
if (chunk.type === 'MustacheTag') {
|
||||
block.contextualise(chunk.expression);
|
||||
const { snippet } = chunk.metadata;
|
||||
|
@ -0,0 +1 @@
|
||||
<div>{{value}}</div>
|
@ -0,0 +1,4 @@
|
||||
export default {
|
||||
data: { foo: 'foo' },
|
||||
html: `<div>foo @ foo # foo</div>`,
|
||||
};
|
6
test/runtime/samples/sigil-component-attribute/main.html
Normal file
6
test/runtime/samples/sigil-component-attribute/main.html
Normal file
@ -0,0 +1,6 @@
|
||||
<Widget value='foo @ {{foo}} # foo'/>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
export default { components: { Widget } };
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user