Re: [csswg-drafts] [selectors][mediaqueries] :media() pseudo-class as a shortcut for one-off media queries (#6247)

> Pseudo-classes are query something about the element, whereas `:media()` is querying the viewport.

I think context _is_ something about the element. A similar API would be `:has()`.

Here is a hypothetical example of context by target class or media query:
```css
:root:is(.dark, :when(media(prefers-color-scheme: dark))) {
 /* dark mode rules */
}
```

Here is a hypothetical example of context by target class or style query:
```css
:root:is(.dark, :when(style(--mode: dark))) {
 /* dark mode rules */
}
```

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


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

Received on Wednesday, 19 October 2022 03:48:52 UTC