-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
The value prop behaves differently in various situations.
Suppose we have a variable let value = undefined.
If you use it on an input element with two-way binding <input bind:value />, the value is not set (this is the correct behavior, it got fixed in #3430).
If you use it on an input element like this: <input {value} />, the input elements value property is set to the string 'undefined' (not the attribute).
If you use it on any other element, like: <option {value} />, the value attribute is set to "undefined".
To Reproduce
https://svelte.dev/repl/9a8cf877df9a47948eb0cd3b04ea8372?version=3.19.1
Expected behavior
I think the value attribute (without two-way binding) should behave like the disabled attribute in the repl.
Severity
low
Additional context
You can get around it with <input value={value || ''} />