Skip to content

Svelte 5: <svelte:element> not working with custom html tags #12714

Closed
@adamspagge

Description

@adamspagge

Describe the bug

svelte:element doesn't work properly with custom elements when using Svelte 5. The element is rendered correctly, but the necessary unique class name is not added thus the scoped css styles are not working. The example is working fine in Svelte 4.

Example with <svelte:element this={"custom-element"}></svelte:element>

Snímek obrazovky 2024-08-02 v 18 49 40

Reproduction

Svelte 5 REPO

Svelte 4 REPO

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 72.89 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.4.0 - ~/.nvm/versions/node/v21.4.0/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v21.4.0/bin/npm
    pnpm: 9.6.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 127.0.6533.89
    Safari: 17.5

Severity

annoyance

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