8000 It would be nice to be able to write a slot without an extra DOM element · Issue #2080 · sveltejs/svelte · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
It would be nice to be able to write a slot without an extra DOM element #2080
Closed
@chris-morgan

Description

@chris-morgan

Currently, you need a single DOM element to fill a slot. This limits slots’ usefulness in various scenarios.

#1037 and #1713 are about allowing a Svelte component to fill a slot, and I believe there is consensus in v3 that this is desirable and intended. Given that a component does not necessarily render to a single DOM element, this is interesting.

It would also be nice to be able to do this without needing to create a whole new component, or a DOM element. Two strawman syntaxes:

{#slot "foo"}
    …
{/slot}
<div slot="foo" svelte:slot-behaviour="exclude-wrapping-element">
    …
</div>

There may be considerations for Custom Elements, but if it’s sorted out for all Svelte components first then there should be nothing fundamentally new here.

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

      0