- From: Keith Cirkel via GitHub <sysbot+gh@w3.org>
- Date: Mon, 15 Jan 2024 10:41:20 +0000
- To: public-css-archive@w3.org
keithamus has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-shadow-parts] Should `::part():lang()` and `::part():dir()` be valid? == ## 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](https://searchfox.org/mozilla-central/source/servo/components/style/gecko/selector_parser.rs#399-417)). 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 :wink:). Given Safari already parses and properly invalidates `:lang`/`:dir` on `::part()`, I thought I'd add some WPTs ([parsing](https://wpt.fyi/results/css/selectors/parsing/parse-part.html?label=master&label=experimental&aligned), [invalidation of `::part():lang()`](https://wpt.fyi/results/css/selectors/invalidation/part-lang.html?label=master&label=experimental&aligned), [invalidation of `::part():dir()`](https://wpt.fyi/results/css/selectors/invalidation/part-dir.html?label=master&label=experimental&aligned&q=%2Fcss%2Fselectors%2Finvalidation%2Fpart-dir.html)). 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?** Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9795 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 15 January 2024 10:41:22 UTC