Re: [csswg-drafts] [css-values-5] Maybe min, max and step should not be part of the random-caching-key (#11742)

So just to distill this down, my pushback here is that, today, for *all* CSS values, the precise source location of a value doesn't matter. (Some things care about which *tree context* a value's stylesheet is in, but that's the extent of it.) So `.foo, .bar { prop: value; }` is exactly identical to `.foo { prop: value; } .bar { prop: value; }` in terms of observable effects, `.foo { prop: value; }` is identical to `.foo:nth-child(even) { prop: value; } .foo:nth-child(odd) { prop: value; }`, etc.

Having `random()` infer a caching key from its source location would break these equivalencies. I don't know that ya'll have fully considered this ramification, and how tooling might currently be implicitly depending on it. It also has weird interactions with unregistered variables, since its "source location" would be the real/registered property it's subbed into, instead.

The only way to avoid this is to make the `random()` value depend, in some way, only on its arguments.  Some possibilities:

* The current spec takes all arguments into account to decrease the chance of accidental coupling between independent values.

* We could alternately just make it depend solely on the key argument. This would mean that *all* values are associated by default.

* I know I originally considered making the default key dependent on the property it's used in. That might be a good middle ground. Still *a little* confusing in variables, but it means that the values will be associated when used in the same property and unassociated when used in others, which should usually be right. (Registered custom properties will still resolve the random() "early" so they'll be the same value everywhere.)

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


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

Received on Wednesday, 26 February 2025 22:53:51 UTC