W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2018

[csswg-drafts] [css-conditional-4] selector() feature query function for selector support

From: L. David Baron via GitHub <sysbot+gh@w3.org>
Date: Fri, 12 Oct 2018 00:04:12 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-369350758-1539302651-sysbot+gh@w3.org>
dbaron has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-conditional-4] selector() feature query function for selector support ==
I think one feature we should add to Conditional Rules Level 4 is a feature query function to test for selector support, presumably called `selector()`.

I've started a [draft of an explainer for this](https://github.com/dbaron/css-supports-functions/blob/master/explainer.md), from which I quote the relevant section:

-----

Having feature queries based on selectors is probably the highest priority addition, both because it seems the most likely to be important in the near future, and because it is the simplest.  It has come up recently because CSS authors using the features in the [CSS Scrollbars Module Level 1](https://drafts.csswg.org/css-scrollbars-1/) may want to query for support of those features, and may also want to query for support of the `::-webkit-scrollbar` pseudo-element.

I believe a possible syntax for such a feature was discussed at one point early in the development of `@supports`, but I can't find meeting minutes of the discussion.  I think the best way to extend the syntax is using a `selector()` function, as in:

```css
@supports (scrollbar-width: thin) or selector(::-webkit-scrollbar) {
  #chatwindow { overflow: scroll; scrollbar-width: thin }
  #chatwindow::-webkit-scrollbar { width: 5px }
}
```

It is worth noting that this usage requires that the `selector()` feature query function *not* copy the quirks that are present in selector parsing, where all `::-webkit-*` pseudo-elements behave as though they're supported (and allow the selector to parse).  Instead, inside of the `selector()` feature query function, this quirk should not be present, and a `selector()` function containing a `::-webkit-*` pseudo-element should only be true if the pseudo-element is *actually* supported.

Other than this, the function should work just as the tests for support/validity work in the [rules on handling invalid selectors](https://drafts.csswg.org/selectors-4/#invalid).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3207 using your GitHub account
Received on Friday, 12 October 2018 00:04:15 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:38 UTC