diff --git a/plugins/bindable.js b/plugins/bindable.js index efcf938e..b3424084 100644 --- a/plugins/bindable.js +++ b/plugins/bindable.js @@ -9,7 +9,7 @@ function transform({ node, environment }) { const object = node.attributes.bind.object ?? {} const property = node.attributes.bind.property if (node.type === 'textarea') { - node.children = [object[property]] + node.children = [object[property] ?? ''] } else if (node.type === 'input' && node.attributes.type === 'checkbox') { node.attributes.checked = object[property] } else { diff --git a/tests/src/TwoWayBindings.njs b/tests/src/TwoWayBindings.njs index cc73b6b7..64a77596 100644 --- a/tests/src/TwoWayBindings.njs +++ b/tests/src/TwoWayBindings.njs @@ -97,6 +97,8 @@ class TwoWayBindings extends Nullstack { +