Skip to content

Commit 14ca56e

Browse files
committed
escape @ sigils in dev tooling events (#3545)
1 parent c250793 commit 14ca56e

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/compiler/compile/render_dom/Block.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import CodeBuilder from '../utils/CodeBuilder';
22
import deindent from '../utils/deindent';
33
import Renderer from './Renderer';
44
import Wrapper from './wrappers/shared/Wrapper';
5-
import { escape } from '../utils/stringify';
5+
import { stringify, escape } from '../utils/stringify';
66

77
export interface BlockOptions {
88
parent?: Block;
@@ -378,7 +378,7 @@ export default class Block {
378378
const block = {
379379
${properties}
380380
};
381-
@dispatch_dev("SvelteRegisterBlock", { block, id: ${this.name || 'create_fragment'}.name, type: "${this.type}", source: "${this.comment ? this.comment.replace(/"/g, '\\"') : ''}", ctx });
381+
@dispatch_dev("SvelteRegisterBlock", { block, id: ${this.name || 'create_fragment'}.name, type: "${this.type}", source: ${stringify(this.comment || '', { only_escape_at_symbol: true })}, ctx });
382382
return block;`
383383
: deindent`
384384
return {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
export default {
2+
compileOptions: {
3+
dev: true
4+
},
25
props: { foo: 'foo' },
36
html: `<div>foo @ foo # foo</div>`,
47
};

test/runtime/samples/sigil-component-attribute/main.svelte test/runtime/samples/sigil-component-prop/main.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
export let foo;
44
</script>
55

6-
<Widget value='foo @ {foo} # foo'/>
6+
<Widget value='foo @ {foo} # foo'>
7+
</Widget>

0 commit comments

Comments
 (0)