Re: [csswg-drafts] [css-values-5] Caching CSS random() values in custom functions (#13661)

> if we rely on element-scoped to handle that (being distinct both from the applying element and distinct across invocations), then we don't need to include the function name in the random-ua-ident; we'd just need the arg name/index to make the values distinct within a function, as usual.

This sounds good.

About:

> That case should work the same as an untyped return value, taking its property name/index post-substitution. Does that sound reasonable?

Shouldn't we evaluate `random()`  value inside the custom function, if custom function is typed?  ([link to spec](https://drafts.csswg.org/css-mixins-1/#evaluate-a-custom-function)). 

```
@function --foo() returns <number> {
    result: random(1, 1000);
}
@function --bar() {
    result: random(1, 1000);
}

...
scale: --foo();
scale: --bar();
```

So in example above while for unregistered `--bar()` we first substitute and then evaluate random() `scale: random(-1, 1000); ` -> `scale: 33 `, but for registered `--foo()` we first evaluate random() and then substitute, i.e.:  `random(1, 1000);` -> `result: 33 ` -> `scale: 33 `

Can we do same for typed return values as for arguments, i.e. `element-scoped` will handle the distinctness across invocations and we can add either 'result' or function name (since result is only for debugging purposes) to random-ua-ident;, same way as arg name.


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


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

Received on Thursday, 23 April 2026 13:59:03 UTC