Last week I went to CSS Day, a wonderful conference about, yes, CSS in Amsterdam. I noticed that the list of speakers on the homepage is displayed in a different order every time you refresh the page. I like that. Of course it’s pretty easy to create a script on the server or on the client to randomise the items in a list, but I thought a
random attribute would be nice.
I tweeted about this idea and I got a few interesting reactions. Peter Gastton said this
sounds like a perfect use case for web components. Which might be true. But to be honest, I’d prefer a simple attribute for such a basic feature. But what attribute?
Random as default
At first I said I’d like something like
<ul random>. But shouldn’t a random order of the items in an unordered list be the default? So instead of a
random attribute, we could add an
unrandom attribute, for those cases when you think the order of an unordered list matters. Quite a few people responded to this idea. And nobody liked it. Paul Verbeek, Jeroen Visser and Peter van Grieken all said that the fact that it’s unordered doesn’t mean it should be in a different order each time you visit. Somehow, order seems to matter in an unordered list. Jeroen convinced me with a few simple examples.
An attribute or an element
random should not be the default. Maybe it should be a separate element instead of an attribute? Something like
<rl>? I suggested that to Paul in my conversation with him, and — great minds — Jeroen came up with the same idea at the same time. I like the argument against an element and in favour of an attribute by Paul: an attribute can be used on other elements as well, like
<dl random>, or — a bit more complex —