W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2020

Re: [csswg-drafts] [css-conditional] CSS.supports for media queries? (#5272)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Tue, 30 Jun 2020 18:03:56 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-651954249-1593540235-sysbot+gh@w3.org>
What about

```js
let testMedia = str => matchMedia(`${str}, not ${str}`).matches;
testMedia("(prefers-this-doesnt-exist: lolwat)"); // false
testMedia("(prefers-color-scheme: light)"); // true
```

or

```js
let testMedia = str => matchMedia(str).media === str;
testMedia("(prefers-this-doesnt-exist: lolwat)"); // false
testMedia("(prefers-color-scheme: light)"); // true
```

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5272#issuecomment-651954249 using your GitHub account
Received on Tuesday, 30 June 2020 18:04:34 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:09 UTC