Post #1180447
2026-04-15 11:24 UTC
Selectors in CSS are fast, but not when your app has too many DOM nodes and the selector in question is a non-optimal `:has()` — that can still introduce significant performance regressions in practice.
`:has()` should be your last resort — very often, using static templating or even JS instead could be a better idea.
Bad: `.foo:has(.bar)`
Ok: `.foo:has(> .bar)`.
Even the `:has() > …` should also be avoided with not precise selectors like `> *` or `> :first-child` — those can be bad too.
Replies (0)
No replies.