The reasons come down to performance. We can see this from a couple of snippets from the Selectors Level 4 spec, where it discusses the Live and snapshot profiles
Selectors are used in many different contexts, with wildly varying performance characteristics. Some powerful selectors are unfortunately too slow to realistically include in the more performance-sensitive contexts.
ISSUE 1 - The categorization of things into the “live” or snapshot profiles needs implementor review. If some things currently not in the live profile can reasonably be done in CSS Selectors, we should move them.
In this particular case <a> before <div> could be done using the has() pseudo-class as a:has(+ div) or a:has(~ div), but has() is only part of the snapshot profile and therefore not for implementation in CSS.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The reasons come down to performance. We can see this from a couple of snippets from the Selectors Level 4 spec, where it discusses the Live and snapshot profiles
In this particular case
<a>
before<div>
could be done using thehas()
pseudo-class asa:has(+ div)
ora:has(~ div)
, buthas()
is only part of the snapshot profile and therefore not for implementation in CSS.