You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[selectors-4] Legacy : pseudo-element cannot appear before type/subclass selectors #8122
Chrome/FF seems to parse :before#id or :before.class as invalid (instead of valid and matching nothing) but I do not see on which part of the spec this is based.
Pseudo-elements are featureless, and so can’t be matched by any other selector
This does not make them invalid.
Legacy : pseudo-element syntax is defined in <subclass-selector> as a <pseudo-class-selector>.
Subclass selectors can appear in any order while still selecting the same set of elements, but this is not true for a pseudo-element specified with the legacy single : syntax.
Therefore I assume that :before must be handled as if it has been specified with ::before and matched <pseudo-element-selector>. If so, it may be helpfull to define it in the spec.
A similar confusion occurred to me when parsing a <color-stop-list>, whose syntax requires two color stops but its grammar accepts an implicit color stop defining two stops with the same color.
Activity
tabatkins commentedon Nov 22, 2022
The intent of the additional rule is to say that you can spell a few pseudo-elements with a single colon:
I should probably write that out more clearly. I can just merge that into the grammar itself rather than putting it in prose.
[selectors] Move the legacy pseudo-element syntax into the grammar it…
tabatkins commentedon Nov 22, 2022
And done.
cdoublev commentedon Nov 23, 2022
Thanks, I am satisfied and happy that I do not have to implement a custom validation.
[selectors] Move the legacy pseudo-element syntax into the grammar it…