[csswg-drafts] [cssom] Missing/outdated serialization rules for pseudo-classes (#12669)

AtkinsSJ has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom] Missing/outdated serialization rules for pseudo-classes ==
The [spec algorithm](https://drafts.csswg.org/cssom/#serialize-a-simple-selector) for serializing pseudo-classes is outdated and missing a lot of newer ones. Specifically it currently lists:

- `:lang()`
- `:nth-child()`: Missing `[of S]?` handling
- `:nth-last-child()`: Missing `[of S]?` handling
- `:nth-of-type()`
- `:nth-last-of-type()`
- `:not()`

And is missing these from level 4:
- `:dir()`
- `:is()`
- `:has()`
- `:where()`
- `:nth-col()`
- `:nth-last-col()`

And from level 5:
- `:state()`
- `:heading()`

cc: @emilio @therealglazou 

As a side note, would it be worth moving the logic for these into the selectors spec and having CSSOM refer to that? I think putting the serialization rules with the pseudo-elements themselves would help keep them up to date, and avoid the issue of which ones should be included in the serialization algorithm.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12669 using your GitHub account


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

Received on Thursday, 28 August 2025 09:10:17 UTC