Context
When implementing CSS CustomStateSet (:state(x)) one of the test cases became using it after ::part(x) which seems very reasonable; there are many existing states which are allowable on ::part(x) such as :focus, :hover and so on so it stands to reason that custom states should also be allowed.
:state(x) highlighted something tricky though, because Stylo's parser special cases functional pseudo selectors, of which there are :dir(), :lang(), and now :state(). Stylo explicitly flags :part() so it can disallow :lang/:dir (see this code where after_part is checked). WebKit, on the other hand, does not discriminate functional pseudo selectors from their non-functional counterparts, and so ::part(x):lang(y) works and also handles all the proper invalidation. Chrome does not successfully parse these selectors either, but I can't speak for how Chrome's parser works in this regard, perhaps @josepharhar can.
When speaking with @emilio about this, I was encouraged to file this very spec issue (better late than never 😉).
Given Safari already parses and properly invalidates :lang/:dir on ::part(), I thought I'd add some WPTs (parsing, invalidation of ::part():lang(), invalidation of ::part():dir(), cc @nt1m). We can clearly see Safari is the outlier in this regard, as Chrome nor Firefox parse the selectors.
Problem statement
The question becomes: should Safari disallow :lang()/:dir() after part? Or should Firefox & Chrome allow it?
Context
When implementing CSS CustomStateSet (
:state(x)) one of the test cases became using it after::part(x)which seems very reasonable; there are many existing states which are allowable on::part(x)such as:focus,:hoverand so on so it stands to reason that custom states should also be allowed.:state(x)highlighted something tricky though, because Stylo's parser special cases functional pseudo selectors, of which there are:dir(),:lang(), and now:state(). Stylo explicitly flags:part()so it can disallow:lang/:dir(see this code whereafter_partis checked). WebKit, on the other hand, does not discriminate functional pseudo selectors from their non-functional counterparts, and so::part(x):lang(y)works and also handles all the proper invalidation. Chrome does not successfully parse these selectors either, but I can't speak for how Chrome's parser works in this regard, perhaps @josepharhar can.When speaking with @emilio about this, I was encouraged to file this very spec issue (better late than never 😉).
Given Safari already parses and properly invalidates
:lang/:diron::part(), I thought I'd add some WPTs (parsing, invalidation of::part():lang(), invalidation of::part():dir(), cc @nt1m). We can clearly see Safari is the outlier in this regard, as Chrome nor Firefox parse the selectors.Problem statement
The question becomes: should Safari disallow
:lang()/:dir()after part? Or should Firefox & Chrome allow it?