-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
input type="number"
bindings can be null
and undefined
#8095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've tried with 3 different browsers (Chrome, Edge and Firefox), all results in undefined rather than null |
It's undefined initially, but when emptying the input, it becomes |
<input type="number"
value is null, not undefinedinput type="number"
bindings can be null
and undefined
To me this feels more like a documentation issue - validity does not change the bound value either (unless the docs talk about some kind of validity I am unaware of). If you want a more consistent value, initialize the state to |
The docs were indeed updated to Is it standard behaviour that |
<script>
import Component from './Component.svelte';
let value = undefined;
</script>
<Component {value} /> <!-- Component.svelte -->
<script>
export let value = 1;
</script>
Value: {value} There is a change in Svelte 5 that when a binding is used, De facto the same should be true for input elements, they always have a fallback value. |
Yep, that makes sense. The input's value is |
Describe the bug
The documentation says:
When the value is initialized, it is indeed
undefined
. However, when later emptying the input, it becomesnull
. In previous versions it did becomeundefined
- #1701 seems to be what changed it in order to fix a warning.Reproduction
https://svelte.dev/repl/58ce9182263245d0b646d115d7e5e1e7?version=3.54.0
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: