Skip to content

bug: The class: directive don't remove existing className on SSR #15338

Closed
@adiguba

Description

@adiguba

Describe the bug

Hi,

This dummy code :

<div class="red" class:red={false}></div>

Should produce something like <div class=""></div> (or <div></div>), because the directive takes precedence over the class attribute.
But that not the case on SSR where the generated code is <div class="red"></div>, which can cause a flash on hydration.

Reproduction

Demo on Sveltelabs (for SSR).
Hit the [RELOAD] button to refresh the page :
https://www.sveltelab.dev/je2q9zussa08osn

Logs

System Info

last version

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions