Skip to content

Svelte 5: Uncaught TypeError: when using event handlers as per svelte 4 #9610

@amit13k

Description

@amit13k

Describe the bug

Valid svelte 4 code leads to console errors,

Example code (try clicking on the input),

<input on:click />
playground:output:1329 Uncaught TypeError: Cannot read properties of undefined (reading 'call')
    at HTMLInputElement.bubble_event (playground:output:1329:8)
    at HTMLInputElement.eval (playground:output:1414:17)

I encountered this when trying to upgrade a project that uses shadcn-svelte.

Is this intended behavior ?

Reproduction

Svelte 5 REPL example

No such error with Svelte 4
Svelte 4 REPL example

Logs

No response

System Info

System:
    OS: macOS 14.2
    CPU: (12) arm64 Apple M2 Pro
    Memory: 140.52 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 6.14.16 - /opt/homebrew/bin/npm
    pnpm: 8.10.5 - /opt/homebrew/bin/pnpm
    bun: 1.0.3 - ~/.bun/bin/bun
  Browsers:
    Chrome: 119.0.6045.159
    Chrome Canary: 121.0.6143.0
    Safari: 17.2

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions