You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since svelte 5.10.1. It's easier to show it then explain it, so see the repro repls below.
That being said; When you have a selector, such as an element or class selector, inside of a :root psuedo-class (think theme switching, :root[data-theme="dark"]), and then have THAT inside of a :global block (think the element you are targeting is inside of a component, svelte (for some reason) does not know what is inside of said component), then the :root psuedo-class is commented out, effecively causing the styles to be applied globally, no matter the theme chosen.
The bug can be mitigated by swapping :root and :global (:root goes around :global and your chosen CSS selector) OR by adding some kind of CSS property inside :root, to acompony the lonely selector.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Since svelte 5.10.1. It's easier to show it then explain it, so see the repro repls below.
That being said; When you have a selector, such as an element or class selector, inside of a :root psuedo-class (think theme switching,
:root[data-theme="dark"]
), and then have THAT inside of a :global block (think the element you are targeting is inside of a component, svelte (for some reason) does not know what is inside of said component), then the :root psuedo-class is commented out, effecively causing the styles to be applied globally, no matter the theme chosen.The bug can be mitigated by swapping :root and :global (:root goes around :global and your chosen CSS selector) OR by adding some kind of CSS property inside :root, to acompony the lonely selector.
I suspect #14577 caused this.
TLDR: Svelte incorrectly parses a non-empty selector inside a :root psuedo-class inside of a :global block as empty.
Reproduction
Code no one would ever use working in 5.10.0: https://svelte.dev/playground/c0590290e2d74a56810d5d5aee532ecf?version=5.10.0
The same code not working in 5.10.1: https://svelte.dev/playground/46d756adb072472baa431c6466ab3c8d?version=5.10.1
Mitigation 1 in 5.10.1: https://svelte.dev/playground/cc94df4a068e425995fb31e1746098ac?version=5.10.1
Mitigation 2 in 5.10.1: https://svelte.dev/playground/1a7ef3a365524fcd81837beefbb84820?version=5.10.1
Note: We do NOT expect the text to be styled red in these reproductions of the issue.
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: