[csswg-drafts] [css-valuies-5] What order to use for the "index of usage" for the default random() keys? (#13337)

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

== [css-valuies-5] What order to use for the "index of usage" for the default random() keys? ==
If you don't specify a dashed-ident in the caching key for random(), one is auto-generated for you using the property name and the index of the random function among other random functions in that value. For example, `border-width: random(0px, 10px) random(10px, 20px);`, it's equivalent to writing `border-width: random(--bw0, 0px, 10px) random(--bw1, 10px, 20px);`. This ensures that two random() functions in a value aren't accidentally linked, but also that when a shorthand implicitly repeats a value, it'll use the same value.

However, the spec doesn't specify exactly what this "order of appearance" is. It appears that Safari uses the order of appearance in the specified value, while Blink uses the "normalized" order that would result from serialization.

For example, given the following styles:

```
.foo {
  box-shadow: calc(10px * random(1, 10)) 10px rgb(255 random(1, 10) 100);
}
.foo:hover {
  box-shadow: rgb(255 random(1, 10) 100) calc(10px * random(1, 10)) 10px;
}
```

If you hover and unhover the element, do you see a change or not? In Safari you see a change - if the first style generates numbers 3 and 7 (creating `30px 10px rgb(255 7 100)`, then the second style will swap what those 3 and 7 are used for (creating `70px 10px rgb(255 3 100)`).  In Blink there's no change.

I don't have much an opinion on which we should go with - linkage across declarations is accidental and not meant to be depended on. So I think it's just what is more natural for implementations. Thoughts?

/cc @tursunova and I think @nt1m ?

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


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

Received on Monday, 12 January 2026 21:23:33 UTC