Re: [csswg-drafts] [mediaqueries] Consider `@media supports()` (#9375)

I’d rather see option 1 land, as with 2 we’ll have the same problem again whenever some new condition gets introduced.

Say – for some weird reason – a `dayofweek` condition gets added. We’d then need a new attribute for it and we’d be doing this whole dance all over again.

---

Taking a step back, you could say the following, since they’re all conditions:

- `@supports` translates to `@if supports(…)`
- `@media` translates to `@if media(…)`
- `@media (prefers-* …)` translates to `@if prefers(…)`

Say there wasn’t any way yet to apply these conditions via HTML yet, I’d come up with a `[condition]` attribute.

```html
condition="supports(…) prefers(…)"
condition="media(…)"
condition="dayofweek(…)" 🤪
```

Lacking such an attribute today, we could reuse `[media]` _(which might need a rename over time?)_ for it instead?

```html
media="supports(…) prefers(…)"
media="media(…)"
```

And yes, `media="media(…)"` is redundant, but over time `[media]` would get renamed to `[condition]` in what I’m suggesting – I see a period of time where UAs would support both to then eventually deprecate `[media]`.

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


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

Received on Wednesday, 13 December 2023 10:10:26 UTC