Re: [csswg-drafts] Greediness of selectors with combinators [selectors-4] (#9605)

Yup, absolutely well-specified. There is no sense of "greediness" in the same way that regexes work; instead, each combinator just resolves to all appropriate elements. In this case, it works like:

* start with all possible elements: a1, b1-1, b1-2, a2, b2, a3, b3
* `a:hover` filters the set: a1 (presumably)
* `~` transforms the set to all following siblings: b1-1, b1-2, s2, b2, a3, b3
* `b` filters the set: b1-1, b1-2, b2, b3

That's your first selector; the second continues from there:

* `~` again transforms the set to the following siblings of each element: b1-2, a2, b2, a3, b3 (there's significant overlap here - a2, for instance, is the following sibling of both b1-1 and b1-2)
* `a` filters the set: a2, a3
* `~` transforms the set to all following siblings: b2, a3, b3
* `b` filters the set: b2, b3

And that's why you see the behavior you observe.


-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9605#issuecomment-1815499381 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 16 November 2023 23:37:45 UTC