Skip to content

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

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

Closed
adiguba opened this issue Mar 2, 2025 · 0 comments · Fixed by #15418
Closed

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

adiguba opened this issue Mar 2, 2025 · 0 comments · Fixed by #15418

Comments

@adiguba
Copy link
Contributor

adiguba commented Mar 2, 2025

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

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

Successfully merging a pull request may close this issue.

1 participant