Skip to content

Commit

Permalink
escape @ sigils in dev tooling events (sveltejs#3545)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Sep 10, 2019
1 parent c250793 commit 88adfb6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/compiler/compile/render_dom/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CodeBuilder from '../utils/CodeBuilder';
import deindent from '../utils/deindent';
import Renderer from './Renderer';
import Wrapper from './wrappers/shared/Wrapper';
import { escape } from '../utils/stringify';
import { stringify, escape } from '../utils/stringify';

export interface BlockOptions {
parent?: Block;
Expand Down Expand Up @@ -378,7 +378,7 @@ export default class Block {
const block = {
${properties}
};
@dispatch_dev("SvelteRegisterBlock", { block, id: ${this.name || 'create_fragment'}.name, type: "${this.type}", source: "${this.comment ? this.comment.replace(/"/g, '\\"') : ''}", ctx });
@dispatch_dev("SvelteRegisterBlock", { block, id: ${this.name || 'create_fragment'}.name, type: "${this.type}", source: ${stringify(this.comment || '', { only_escape_at_symbol: true })}, ctx });
return block;`
: deindent`
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export default {
compileOptions: {
dev: true
},
props: { foo: 'foo' },
html: `<div>foo @ foo # foo</div>`,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
export let foo;
</script>

<Widget value='foo @ {foo} # foo'/>
<Widget value='foo @ {foo} # foo'>
</Widget>

0 comments on commit 88adfb6

Please sign in to comment.