Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

svelte:element with dynamic this and spread attributes #9092

Closed
hamidreza4dev opened this issue Aug 11, 2023 · 0 comments · Fixed by #9112
Closed

svelte:element with dynamic this and spread attributes #9092

hamidreza4dev opened this issue Aug 11, 2023 · 0 comments · Fixed by #9112

Comments

@hamidreza4dev
Copy link

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

@hamidreza4dev hamidreza4dev changed the title very strange behavior when using svelte:element Bugy behavior when using svelte:element Aug 11, 2023
@Conduitry Conduitry changed the title Bugy behavior when using svelte:element svelte:element with dynamic this and spread attributes Aug 11, 2023
dummdidumm added a commit that referenced this issue Sep 20, 2023
…ror (#9112)

fixes #9092

---------

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
kelvinsjk pushed a commit to kelvinsjk/svelte that referenced this issue Oct 19, 2023
…ror (sveltejs#9112)

fixes sveltejs#9092

---------

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant