svelte icon indicating copy to clipboard operation
svelte copied to clipboard

`<progress value={0}>` behaves differently between Svelte 4 and 5

Open Rich-Harris opened this issue 1 year ago • 2 comments

Describe the bug

Reproduction

above

Logs

No response

System Info

next

Severity

annoyance

Rich-Harris avatar Oct 19 '24 02:10 Rich-Harris

It seem that the problem come from this check in set_value() : element.value === value

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;
	// @ts-expect-error
	element.value = value;
}

Indeterminate <progress> seem to have an initial value of 0, so this condition is true and the set is not done.

But I don't known why there a double-check here...

adiguba avatar Oct 19 '24 04:10 adiguba

It seem that the change come from #13574 in order to handle minlength/maxlength

adiguba avatar Oct 19 '24 08:10 adiguba