Skip to content

svelte:element with dynamic this and spread attributes #9092

@hamidreza4dev

Description

@hamidreza4dev

Describe the bug

In the code example below, when I use ...props, there is no problem:

<svelte:element this="div" {...props}>
    this is div !
</svelte:element>

But when I try to make this dynamic, even with a simple string, I get an error saying props is not defined.

<svelte:element this={"div"} {...props}>
    this is div !
</svelte:element>

Reproduction

https://svelte.dev/repl/1c5c200152784ab9802b2333b01124f1?version=4.1.2

Logs

Uncaught ReferenceError: props is not defined

System Info

System:
    OS: macOS 12.6.7
    CPU: (8) arm64 Apple M2
    Memory: 113.55 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.4.0 - ~/.nvm/versions/node/v20.4.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.4.0/bin/yarn
    npm: 9.7.2 - ~/.nvm/versions/node/v20.4.0/bin/npm
    pnpm: 8.6.10 - ~/.nvm/versions/node/v20.4.0/bin/pnpm
  Browsers:
    Brave Browser: 115.1.56.14
    Safari: 15.6.1
  npmPackages:
    rollup: ^3.27.2 => 3.27.2 
    svelte: ^4.0.5 => 4.1.2

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