[csswg-drafts] [css-values-5] Caching CSS random() values in if() (#13662)

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

== [css-values-5] Caching CSS random() values in if() ==
There is [an existing issue](https://github.com/w3c/csswg-drafts/issues/10982) about random() and other tree scope functions used outside element context, so it is unclear how random() should behave in `@container` style  queries now. However we can also use random() in style()  condition inside `if()`:

```css
color: if(style(random(--rand property index, 1, 1000) = random(--rand property index, 1, 1000)): green; else: red;);
```

In the example above it's unclear whether both random() values should use same or different index for caching, in other words, what is **the same property value** in the statement below:

>A nullable [integer](https://drafts.csswg.org/css-values-4/#integer) index: the index of the [random function](https://drafts.csswg.org/css-values-5/#css-random-function) among other random functions in **the same property value**, if [index](https://drafts.csswg.org/css-values-5/#valdef-random-index) or [auto](https://drafts.csswg.org/css-values-5/#valdef-random-auto) is specified; otherwise null.

```
if(style(random(1) = random(2)): random(3); else: random(4));
```

So are `random(1)`, `random(2)`, `random(3)` and `random(4)` all different property values?

cc: @tabatkins

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


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

Received on Monday, 16 March 2026 13:28:19 UTC