Implement CSS random() function
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
People
(Reporter: canadahonk, Unassigned)
References
(Depends on 3 open bugs, Blocks 7 open bugs, )
Details
(Keywords: web-feature)
User Story
web-feature: random-function
Implement the CSS random() function defined by CSS Values and Units Module Level 5.
No WPT tests exist currently (they should be added if implemented by us first). Not implemented or shipped by any engine yet.
Standards position: https://github.com/mozilla/standards-positions/issues/809
| Reporter | ||
Comment 1•2 years ago
|
||
The standards position is currently negative so this likely won't be shipped or (internally) worked on (anytime soon at least). See also spec issue: https://github.com/w3c/csswg-drafts/issues/2826
The negative position on random() is unfortunate to hear. Over the past 10 years many SASS users have gotten use to using the math.random() module: https://sass-lang.com/documentation/modules/math/#random. Not having this in CSS proper could be a reason for people to not return to vanilla CSS.
The standards position is now positive and random()+random-item() has been added to the specification: https://www.w3.org/TR/css-values-5/#randomness
The WebKit engineers have started contributing WPT's, so they are probably working on implementing it: https://github.com/web-platform-tests/wpt/pull/50073
Updated•2 months ago
|
Comment 5•2 months ago
|
||
When we get to implement this, we need to make sure to not just perma-leak all random values. Just using a rng seeded with the relevant key hashes instead would do, probably...
Updated•18 days ago
|
Updated•17 days ago
|
Description
•