diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index e4c47cb52fe9..f3d87ab2b137 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -55,7 +55,7 @@ export default class Element extends Node { attribute.name === 'value' ) { let select = this.parent; - while (select && select.type !== 'Element' || select.name !== 'select') select = select.parent; + while (select && (select.type !== 'Element' || select.name !== 'select')) select = select.parent; if (select && select.selectBindingDependencies) { select.selectBindingDependencies.forEach(prop => { diff --git a/test/runtime/samples/option-without-select/_config.js b/test/runtime/samples/option-without-select/_config.js new file mode 100644 index 000000000000..95c250458276 --- /dev/null +++ b/test/runtime/samples/option-without-select/_config.js @@ -0,0 +1,14 @@ +export default { + data: { + foo: 'hello' + }, + + html: ``, + + test(assert, component, target) { + component.set({ foo: 'goodbye' }); + assert.htmlEqual(target.innerHTML, ` + + `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/option-without-select/main.html b/test/runtime/samples/option-without-select/main.html new file mode 100644 index 000000000000..36c101d13dd3 --- /dev/null +++ b/test/runtime/samples/option-without-select/main.html @@ -0,0 +1 @@ + \ No newline at end of file