diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 7087336a6b..cc1996abdf 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -138,7 +138,7 @@ export function get_binding_group_value(group, __value, checked) { } export function to_number(value) { - return value === '' ? undefined : +value; + return value === '' ? null : +value; } export function time_ranges_to_array(ranges) { diff --git a/test/runtime/samples/binding-input-number/_config.js b/test/runtime/samples/binding-input-number/_config.js index 3c5919bc64..1a56a75c0c 100644 --- a/test/runtime/samples/binding-input-number/_config.js +++ b/test/runtime/samples/binding-input-number/_config.js @@ -35,14 +35,14 @@ export default {
number 44
`); - // empty string should be treated as undefined + // empty string should be treated as null input.value = ''; await input.dispatchEvent(event); - assert.equal(component.count, undefined); + assert.equal(component.count, null); assert.htmlEqual(target.innerHTML, ` -undefined undefined
+object null
`); } };