Gah why doesn't CSS have a `random()` math function, would be super handy right now
Conversation
Notices
-
Embed this notice
Thomas 🔭✨ (thomasfuchs@hachyderm.io)'s status on Friday, 10-Mar-2023 02:03:13 JST Thomas 🔭✨
-
Embed this notice
Thomas 🔭✨ (thomasfuchs@hachyderm.io)'s status on Friday, 10-Mar-2023 03:18:23 JST Thomas 🔭✨
@jnegre_org random() would be a one time operation
-
Embed this notice
Jérôme Nègre (jnegre_org@piaille.fr)'s status on Friday, 10-Mar-2023 03:18:25 JST Jérôme Nègre
@thomasfuchs wouldn't it be a nightmare for the perf of the browser if the actual CSS changes on every rendering?
-
Embed this notice
Thomas 🔭✨ (thomasfuchs@hachyderm.io)'s status on Friday, 10-Mar-2023 23:32:50 JST Thomas 🔭✨
@MdPoppa I use CSS math all the time. https://developer.mozilla.org/en-US/docs/Web/CSS/calc
-
Embed this notice
Md.Poppa (mdpoppa@nerdculture.de)'s status on Friday, 10-Mar-2023 23:32:52 JST Md.Poppa
@thomasfuchs CSS is for styling. Is there any actual 'function' component in CSS?
In conversation permalink -
Embed this notice
Thomas 🔭✨ (thomasfuchs@hachyderm.io)'s status on Friday, 10-Mar-2023 23:33:42 JST Thomas 🔭✨
@zalasur That doesn't compute because I can just use JavaScript instead which is always available.
In conversation permalink -
Embed this notice
Zalasur 🐵 (zalasur@mastodon.surazal.net)'s status on Friday, 10-Mar-2023 23:33:43 JST Zalasur 🐵
@thomasfuchs It would have to be a client-side function which would open up an implementation can of worms. Some backend random number generators are even security risks. I can see why it would not be part of the spec.
In conversation permalink -
Embed this notice
Thomas 🔭✨ (thomasfuchs@hachyderm.io)'s status on Friday, 10-Mar-2023 23:35:37 JST Thomas 🔭✨
@chris_e_simpson @deivudesu That's why every good implementation of random number generators has a a seed function, which you can override to have deterministic results for testing.
You'd just need to set that seed on `:root` with a CSS property and you'd be done.
You guys are making things up to defend the lack of a useful feature for designers. ?
In conversation permalink -
Embed this notice
Chris Simpson (chris_e_simpson@hachyderm.io)'s status on Friday, 10-Mar-2023 23:35:39 JST Chris Simpson
@deivudesu @thomasfuchs For sure. Random is a can of worms for testing.
In conversation permalink -
Embed this notice
デイヴ (deivudesu@mastodon.social)'s status on Friday, 10-Mar-2023 23:35:40 JST デイヴ
@thomasfuchs I feel like there's a bit of a philosophical (unwritten?) rule about CSS being absolutely deterministic. And that would sorta undermine that philosophy? ?
In conversation permalink
-
Embed this notice