fix: treat `undefined` and `null` the same for the initial input value

Fixes #14558
pull/14562/head
Simon Holthausen 2 years ago
parent 4b802dbed3
commit aaa88122c3

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: treat `undefined` and `null` the same for the initial input value

@ -61,7 +61,10 @@ export function set_value(element, value) {
// @ts-expect-error
var attributes = (element.__attributes ??= {});
if (
attributes.value === (attributes.value = value) ||
attributes.value ===
(attributes.value =
// treat null and undefined the same for the initial value
value ?? undefined) ||
// @ts-expect-error
// `progress` elements always need their value set when its `0`
(element.value === value && (value !== 0 || element.nodeName !== 'PROGRESS'))

Loading…
Cancel
Save