You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError
TypeError: Cannot read properties of undefined (reading 'call')
at eval (playground:output:2036:21)
at without_reactive_context (playground:output:2004:11)
at HTMLButtonElement.target_handler (playground:output:2035:12)
System Info
Svelte 5.19.1 (Playground)
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered:
The reason for that is if you look at the compiled output, you'll notice that for onclick, it assigns a property of the button to the event handler, while with the other event, it calls a function. In the function, it runs Element.addEventListener, which throws if the provided handler is not a function. You shouldn't have a nullish event handler (partly because there's no reason to).
Describe the bug
Some event handlers, such as
onmouseenter
oronmouseleave
, throw an error when set tonull
/undefined
instead of not registering the event handler.Reproduction
https://svelte.dev/playground/fa643cc4e0ed4434bb6ba9bc5a5a8ec0?version=5.19.1
Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: