Skip to content

Svelte 5 : Basic HTML Javascript Functions do NOT work in Svelte Anymore #9437

Closed as not planned
@svelteagen

Description

@svelteagen

Describe the bug

In Svelte 4 and previous versions, I could write this code and it would be fine
<div onload="svelteloader()"
with the funtion svelteloader defined in a /js/main.js file.

Now when I try this in Svelte 5 it FORCES me to use Svelte's on:load instead of HTML, and throws the error
"Event attribute must be a JavaScript expression, not a string svelte (invalid-event-attribute-value)"

Please fix. It broke my entire project! This is really broken.

Also it wouldn't let me use tags like body and other very weird things that are basic HTML Svelte should allow.

Reproduction

N/A (private repo)

Logs

No response

System Info

Windows 10

Severity

blocking all usage of svelte

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