[csswg-drafts] Feature detection for descriptors

xfq has just created a new issue for https://github.com/w3c/csswg-drafts:

== Feature detection for descriptors ==
Currently, `@supports` and `CSS.supports` only support `property: value` pairs. The only way for web developers to detect support for a certain descriptor in an at-rule is to use JavaScript. For example:

```javascript
let e = document.createElement("style");
e.textContent = "@font-face { font-display: swap; }";
document.documentElement.appendChild(e);
let isFontDisplaySupported = e.sheet.cssRules[0].cssText.indexOf("font-display") != -1;
```

(from https://bugzilla.mozilla.org/show_bug.cgi?id=1296373#c6)

It would be good if CSS can test whether a user agent supports a `descriptor: value` pair.

See also a related issue in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=600137

Tagged as "unknown/future spec" for now, because I'm not sure if we should extend `@supports` (which is in `css-conditional`), or develop a new mechanism for it.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2463 using your GitHub account

Received on Thursday, 22 March 2018 10:01:33 UTC