Skip to content

bug: SSR merge_styles() don't handle correctly some style attributes #15416

Closed
@adiguba

Description

@adiguba

Describe the bug

On SSR the style:directive use merge_styles() to merge the style attribute with the directives...

But it is too simplistic since it is based on a split(';'), and have some issues :

  • It remove all duplicate properties, which can be problematic as it can be used for compatibility.
    (ex: "background-image:url(...); background-image: linear-gradient(...)")

  • Comment are parsed and can be truncated in some case, which may generate an incorrect value.

  • The ; inside quote or url() are used as split token, witch break the CSS property.

Note that this report mainly serves as a follow-up.
I currently work on a set_style() equivalent of #15352 that should handle theses cases.

Reproduction

https://www.sveltelab.dev/2jxwcou89yzclca

Logs

-

System Info

last version

Severity

annoyance

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