Closed Bug 1836588 (css-random) Opened 3 years ago Closed 3 days ago

Implement CSS random() function

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: canadahonk, Assigned: sajidanwar)

References

(Depends on 5 open bugs, Blocks 15 open bugs, )

Details

(Keywords: parity-chrome, parity-safari, web-feature)

User Story

web-feature:random-function
webcompat-risk:moderate

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

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

Blocks: 2017269
Blocks: 2016731
Duplicate of this bug: 2019274
Alias: css-random

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...

Blocks: 2025095
Depends on: 2031432
Depends on: 2031924
Depends on: 2034341
User Story: (updated)
Keywords: web-feature
Blocks: 2059746
Blocks: 2059514
Blocks: 2065136
No longer blocks: 2065136
Blocks: 2062996
Blocks: 2064584
Blocks: 2065559
Blocks: 2066488
Assignee: nobody → sajidanwar94
Status: NEW → ASSIGNED
Depends on: 2071165
Depends on: 2071366
Depends on: 2071971
Depends on: 2072088
Depends on: 2072252
Depends on: 2072452
User Story: (updated)
Depends on: 2086202
Status: ASSIGNED → RESOLVED
Closed: 3 days ago
Resolution: --- → FIXED
Blocks: 2099122
You need to log in before you can comment on or make changes to this bug.