Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Svelte 5: Custom element's default <slot> not created when no initial children are passed #13638

Open
CLDXiang opened this issue Oct 17, 2024 · 0 comments

Comments

@CLDXiang
Copy link

CLDXiang commented Oct 17, 2024

Describe the bug

When Svelte creates a custom element, if no child elements are initially passed in, the default <slot> tag will not be created, causing subsequently added child elements to not be rendered in the slot.

It seems that this part might be responsible:

result[/** @type {Element} node */ (node).slot || 'default'] = true;

Hope this helps with troubleshooting the issue.

Reproduction

https://github.com/CLDXiang/svelte-custom-element-no-default-slot-bug

Initial state:
image

Append some children:
image

Logs

No response

System Info

System:
    OS: macOS 15.0.1
    CPU: (20) x64 Intel(R) Core(TM) i9-10910 CPU @ 3.60GHz
    Memory: 158.62 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v18.20.4/bin/npm
    pnpm: 9.12.1 - ~/.nvm/versions/node/v18.20.4/bin/pnpm
    bun: 1.0.11 - ~/.bun/bin/bun
  Browsers:
    Chrome: 129.0.6668.101
    Safari: 18.0.1

Severity

annoyance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants