From 8de4145cb2ac7a30a9483ab67145a1319989c892 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 24 Apr 2018 21:56:18 -0400 Subject: [PATCH] textarea special case --- src/generators/nodes/Binding.ts | 4 ++-- src/generators/nodes/Element.ts | 33 +++++++++++++++------------------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/generators/nodes/Binding.ts b/src/generators/nodes/Binding.ts index 4aca1807e0..2ff5a88ef7 100644 --- a/src/generators/nodes/Binding.ts +++ b/src/generators/nodes/Binding.ts @@ -205,7 +205,7 @@ function getEventHandler( usesState: true, usesStore: storeDependencies.length > 0, mutation: `${list}[${index}]${tail} = ${value};`, - props: dependencies.map(prop => `${prop}: state.${prop}`), + props: dependencies.map(prop => `${prop}: ctx.${prop}`), storeProps: storeDependencies.map(prop => `${prop}: $.${prop}`) }; } @@ -225,7 +225,7 @@ function getEventHandler( usesState: true, usesStore: storeDependencies.length > 0, mutation: `${snippet} = ${value}`, - props: dependencies.map((prop: string) => `${prop}: state.${prop}`), + props: dependencies.map((prop: string) => `${prop}: ctx.${prop}`), storeProps: storeDependencies.map(prop => `${prop}: $.${prop}`) }; } diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index 8305884137..7109bfc875 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -51,6 +51,20 @@ export default class Element extends Node { this.intro = null; this.outro = null; + if (this.name === 'textarea') { + // this is an egregious hack, but it's the easiest way to get