Skip to content

Nullish event handler produces TypeError #15081

@vkurko

Description

@vkurko

Describe the bug

Some event handlers, such as onmouseenter or onmouseleave, throw an error when set to null/undefined instead of not registering the event handler.

Reproduction

https://svelte.dev/playground/fa643cc4e0ed4434bb6ba9bc5a5a8ec0?version=5.19.1

Logs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions