-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Sibling Combinator combined with :has
can be improperly marked as unused
#14072
Open
craig-jennings opened this issue
Oct 31, 2024
· 2 comments
· Fixed by #14213 · May be fixed by #15207 or #15277
Open
Sibling Combinator combined with :has
can be improperly marked as unused
#14072
craig-jennings opened this issue
Oct 31, 2024
· 2 comments
· Fixed by #14213 · May be fixed by #15207 or #15277
Labels
css
Stuff related to Svelte's built-in CSS handling
Comments
Here is a REPL for a common use case:
|
dummdidumm
added a commit
that referenced
this issue
Nov 7, 2024
We didn't collect sibling elements of a given element to then check the `:has` selectors. This adds the logic for that. Fixes #14072
5 tasks
@dummdidumm Could we please reopen? Sibling <section class="list">
<div class="list-item">should be red</div>
<div class="list-item"><h2>heading</h2></div>
<div class="list-item">...</div>
</section> /* reported as unused */
.list-item:has( + .list-item h2) {
background: red ;
} /* works only with global */
:global(.list-item:has( + .list-item h2)) {
background: red ;
} Tested in: Svelte Version: [email protected] (I upgraded from 5.0.0-next.260 to [email protected], in 260 this was not an issue) |
6 tasks
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I've got some complex sibling combinator +
:has
css selectors that match the DOM but are reported as unused by Svelte. Through further testing, it appears that some trivial cases are incorrectly marked as unused.Reproduction
./packages/svelte/tests/css/samples/has/input.svelte
style
blockNotice that these are valid selectors based on the given DOM structure
css_unused_selector
errors. I've found that wrappingc
in:global()
seems to get rid of the errors, but I'm not sure if that should be required to get this selector working.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: