-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the problem
While it's a welcomed addition that Svelte 5 is becoming more like vanilla JS, when it comes to events, like onclick={}, onsubmit={}, etc., it's weird why it doesn't allow for it to be camelCased, like so: onClick={} and onSubmit={}.
Even vanilla HTML/JS allows you to camelCase the event name, so it doesn't make sense why Svelte 5 is restricting it to only allowed nocase. Additionally, React is the opposite, where it only allows camelCase, as functions and variables are typically camelCased in JS. If camelCased events were allowed in Svelte 5, it would be easier to do the shorthand syntax of {onClick} (of course it normally should be more descriptive anyway).
Describe the proposed solution
I propose to allow both camelCase and nocase syntax for native events, much like how it already work.
So following would both work:
<button onClick={}>My button</button><button onclick={}>My button</button>Alternatives considered
There's no alternative that I'm aware of.
Importance
would make my life easier