-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Svelte 5: In CSS, mixing :global()
and various selectors throws an error
#9398
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
Comments
I just experienced the same problem, for now this workaround seems to be useable:
Edit: There also seems to be something funky going on in the Svelte 5 repl. When :global() is used the style remains applied even after removing it from the code. This doesn't happen in the Svelte 4 repl. |
Same for a selector like this:
Error: |
@johannesmutter There already is a separate issue for that here: |
closes #9398 (the other things in that issue are already addressed)
Describe the bug
Some CSS selectors throw an error when mixed with
:global()
.This seems to only happen svelte 5, not the earlier versions.
From my experimentation I am relatively sure it happens when adding selectors with
(
and)
, e.g :where(), :has(), :is(), etcReproduction
:global(:where(selector))
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAEyWNywqDMBBFfyXMSiEi3aZS6HdUF1FHGzp5kIwWEf-9Cd1c7gPOPWExhAnU6wSnLYKCZwgggY9QQtqRGHNOfotTabrZ7I-uLdq73nWJD8JiWa3kR02V-r4xYhWk8CTFRnUtzrL3bHVcjWtG8tOnSawjK3FDey_rlVntH5bvrJ_NYnAGxXHDa7h-2NTG_6kAAAA=
:global(:not([attribute]))
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAEyVNywqDMBD8FdmTQlPpNZVCv0M9RLPq0rxIVqmI_15DL8O8mDlgIoMJZHuAUxZBwjsEuAHvIYu0oWG8dPJrHLPTaNpeTZ2xc51rEu8GM-V7pHERjF8u5Gz8oEwpneeyVZGUWEhrdH1VFUcud2xVnMmJwfjxIxKryLJ4oH3m9LyG6__y9W29polQg-S44tmfPzzfVnS2AAAA
:global(:is(.class)
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAEyWOwQrCMBBEfyXsqYLoPVZB_IR6Mx7aZmsXtknJbgul9N9t9DiPecOs0BGjgH2tEOoBwcJ9HOEIuow5yIysuGeJU2ozKT3NpuVa5OpAUdTBzQWnz57EPKrKSB8n9qZBQ2GumbwL5XmXciuUogvjT7Afjk3NhSUpTnnoYNbMnbaRY7Imob9ksOWBv7cfGaKnjtCD1TTh9t6-jKj2HMMAAAA=
^ This demo should be invalid, but does not throw an error
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: