Re: [csswg-drafts] [css-conditional-4] Need a way in CSS to test for support of HTML features (#9746)

>  @nt1m tells me :has() doesn't support pseudo-elements

Not quite; the spec *allows* for `:has()` to take certain pseudo-elements (the [:has-allowed pseudo-elements](https://drafts.csswg.org/selectors/#relational)), but doesn't define any of the existing ones to be in that set.

The basic requirement for a pseudo to be :has-allowed is just that it's not dependent on styling, so you can't introduce cycles with it. Would you be able to shut off the switch pseudos, with `appearance` or something? If so, they can't be :has-allowed; if not, then they could be.

(The hidden extra requirement is that they're not "always there" either, like ::before, because testing for them would be useless in that case.)

----------

Returning to the main topic, yeah, as much as possible we don't want to maintain registries, and want to instead rely on parsing to give us a correct answer automatically. We can probably pull that off with tagnames (based on IDL class, as @Loirooriol said), and likely with input types (they have their own behavior validator that recognizes valid names), but not with attributes in general. Every attribute we add would need special handling.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9746#issuecomment-1869731561 using your GitHub account


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

Received on Tuesday, 26 December 2023 19:24:52 UTC