Render textarea binding values inside element

* ssr-textarea-bind-fix

* oops

* trying again

* Fixing an old test

* avoid creating extra function expression
pull/2990/head
Efe Küçük 6 years ago committed by Rich Harris
parent 99de443181
commit 17c4a25016

@ -146,6 +146,9 @@ export default function(node: Element, renderer: Renderer, options: RenderOption
if (name === 'group') {
// TODO server-render group bindings
} else if (binding.name === 'value' && node.name === 'textarea') {
const snippet = snip(expression);
textarea_contents='${(' + snippet + ') || ""}';
} else {
const snippet = snip(expression);
opening_tag += ' ${(v => v ? ("' + name + '" + (v === true ? "" : "=" + JSON.stringify(v))) : "")(' + snippet + ')}';

@ -9,7 +9,7 @@ export default {
`,
ssrHtml: `
<textarea value="some text"></textarea>
<textarea>some text</textarea>
<p>some text</p>
`,

@ -0,0 +1,5 @@
<script>
let value = 'hello';
</script>
<textarea bind:value></textarea>
Loading…
Cancel
Save