fix: ensure value is correctly set to zero on the progress element

pull/13924/head
Dominic Gannaway 2 years ago
parent feb2d85f46
commit 36896f1080

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure value is correctly set to zero on the progress element

@ -54,8 +54,12 @@ export function remove_input_defaults(input) {
export function set_value(element, value) {
// @ts-expect-error
var attributes = (element.__attributes ??= {});
// @ts-expect-error
if (attributes.value === (attributes.value = value) || element.value === value) return;
if (
attributes.value === (attributes.value = value) ||
// @ts-expect-error <progress> elements report 0 value, but that might not really be 0
(element.value === value && (value !== 0 || element.nodeName !== 'PROGRESS'))
)
return;
// @ts-expect-error
element.value = value;
}

Loading…
Cancel
Save