Skip to content

Commit

Permalink
fix: ensure value is correctly set to zero on the progress element (#…
Browse files Browse the repository at this point in the history
…13924)

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

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

* fix: ensure value is correctly set to zero on the progress element
  • Loading branch information
trueadm authored Oct 25, 2024
1 parent 1e6cf1b commit 37fa34c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-wombats-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: ensure value is correctly set to zero on the progress element
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ 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 always need their value set when its `0`
(element.value === value && (value !== 0 || element.nodeName !== 'PROGRESS'))
)
return;
// @ts-expect-error
element.value = value;
}
Expand Down

0 comments on commit 37fa34c

Please sign in to comment.