mirror of https://github.com/sveltejs/svelte
Merge pull request #747 from sveltejs/gh-741
Fix escaping/unescaping of text and attributes in SSRpull/751/head
commit
207c59986a
@ -1,3 +1,7 @@
|
||||
export default function stringify(data: string) {
|
||||
return JSON.stringify(data.replace(/([^\\@#])?([@#])/g, '$1\\$2'));
|
||||
export function stringify(data: string) {
|
||||
return JSON.stringify(escape(data));
|
||||
}
|
||||
|
||||
export function escape(data: string) {
|
||||
return data.replace(/([^\\@#])?([@#])/g, '$1\\$2');
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
html: `<a href='mailto:hello@example.com'>email</a>`
|
||||
};
|
@ -0,0 +1 @@
|
||||
<a href='mailto:hello@example.com'>email</a>
|
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
html: `<span title='"foo"'>foo</span>`
|
||||
};
|
@ -0,0 +1 @@
|
||||
<span title='"foo"'>foo</span>
|
Loading…
Reference in new issue