We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Svelte incorrectly marks :global() + .class selector as unused and removes it.
:global() + .class
REPL: https://svelte.dev/playground/f6023640ca8e4b659c6bbae9966dca97?version=5.23.0
<!-- Toggle.svelte --> <input type="checkbox" id="checkbox"> <slot /> <!-- App.svelte --> <script> import Toggle from './Toggle.svelte' </script> <div> <!-- Uncomment this and the selector works --> <!-- <span></span> --> <Toggle /> <label for="checkbox" class="btn">Button</label> </div> <style> .btn { background-color: blue; color: white; } :global(:checked) + .btn { background-color: red; color: black; } </style>
The :global(:checked) + .btn selector doesn't work because Svelte removes it as "unused".
:global(:checked) + .btn
Adding an empty <span></span> before the target element makes it work:
<span></span>
<div> <span></span> <Toggle /> <label for="checkbox" class="btn">Button</label> </div>
Svelte Repl 5.23.0
annoyance
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Svelte incorrectly marks
:global() + .class
selector as unused and removes it.Reproduction
REPL: https://svelte.dev/playground/f6023640ca8e4b659c6bbae9966dca97?version=5.23.0
The
:global(:checked) + .btn
selector doesn't work because Svelte removes it as "unused".Adding an empty
<span></span>
before the target element makes it work:Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: