The spec algorithm 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:
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.