Remove JSON.stringify used to encode HTML attributes in SSR. Replace with concatenation of double quotes before and after the value. Fixes #4240

pull/4247/head
Jesse Skinner 6 years ago
parent 6deb57a31c
commit 52d81f9987

@ -25,9 +25,14 @@ export function spread(args, classes_to_add) {
else if (boolean_attributes.has(name.toLowerCase())) {
if (value) str += " " + name;
} else if (value != null) {
str += " " + name + "=" + JSON.stringify(String(value)
str +=
' ' +
name +
'="' +
String(value)
.replace(/"/g, '"')
.replace(/'/g, '''));
.replace(/'/g, ''') +
'"';
}
});

@ -1,3 +1,8 @@
<input value="
bar
" />
">
<input class="
white
space
">

@ -5,3 +5,8 @@
</script>
<input {...props} />
<input class="
white
space
" {...({})}>

Loading…
Cancel
Save