Skip to content

Whitespace issue when mixing slots #2723

@MichelPaus

Description

@MichelPaus

Say we have a component template that provides multiple named slots together with an unnamed one. The default slot is enclosed by named slots, like in the example.

    <slot name="first">
        <span>first slot</span>
    <slot>
        <p>this is the default slot</p>
    </slot>
    <slot name="second">
        <span>second named slot</span>
    </slot>  

The problem arises when you overwrite the named slots, but not the default one. In that case, every piece of whitespace gets loaded as the default slot, which makes it disappear from the DOM.

JSFiddle example

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