[csswg-drafts] [css-conditional-5] Add `container()` as a leaf of the @when rule (#6917)

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

== [css-conditional-5] Add `container()` as a leaf of the @when rule ==
It would be nice to also see a `container()` function as a leaf of the @when rule, in addition to the already specced `media()` and `supports()` functions.

The syntax would preferably be the same as [the `@​container` rule](https://drafts.csswg.org/css-contain-3/#container-rule):

```
container() = container( [ <container-name> | [ name(<container-name>) || type(<container-type>+) ] ]? <container-query> )
```

_(Perhaps the optional part should not be optional here, for performance reasons? đŸ¤”)_

Use case: it would allow stuff such as easy dark mode toggling based on the value of a custom property on a style container:

```css
@when media(prefers-color-scheme: dark) or container(root style(--color-scheme = dark)) {
  body {
    --primary-color: #efefef;
    --primary-bg-color: #333;
  }
}
```

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


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

Received on Tuesday, 28 December 2021 22:50:25 UTC