Re: [csswg-drafts] [selectors] Backwards combinators (#12453)

> Combinators are applied left to right as there are no precedence rules

This was surprising to me, as I'm used to reading selectors right-to-left. I think this might be the first case where reading order can affect the meaning, so it might be worth writing it down as part of this proposal.

It's possible that my bias as an implementer is showing since engines do matching right-to-left. However, I'll note that examples in [the spec](https://www.w3.org/TR/selectors-4/#combinators), [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors/Selectors_and_combinators#combinators), and [W3Schools](https://www.w3schools.com/cssref/css_ref_combinators.php) are also explained in a way that point towards right-to-left reading.

I don't mean to suggest we should prioritize implementer understanding over author understanding; if authors predominantly read selectors left-to-right then I think we should follow that expectation. I would be curious to hear from others on this though.

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


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

Received on Monday, 7 July 2025 19:26:16 UTC