Page MenuHomePhabricator

.history-size could have a data attribute
Closed, ResolvedPublic

Description

On history pages, elements with the HTML class "history-size" could have a data attribute with the number of bytes. To show you what I mean, the current HTML

<span class="history-size">(48,849 bytes)</span>

could be changed to

<span class="history-size" data-bytes="48849">(48,849 bytes)</span>

In other words, the data attribute should be like the text, but without the parens, without the unit (because it's in the attribute name) and without any kind of formatting between the numbers (comma or &nbsp; depending on language).

Solution: change formatRevisionSize in includes/Linker.php.

Event Timeline

Currently this task does not explain why this task was created.
It describes a potential solution to an underlying problem that still needs to get defined...

There is no problem. It would just be nice to have. This is a good example of how data attributes should be used. Exposing this kind of information in a structured way helps gadget authors like myself. Of course, I understand that this is of lowest priority, and that's perfectly fine!

Ah, I think I should read https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes ... :)

information in a structured way helps gadget authors

Thanks. That was the part I was missing initially.

Change 651506 had a related patch set uploaded (by Diwanshu885; owner: Diwanshu885):
[mediawiki/core@master] Add data attribute to the elements with class "history-size"

https://gerrit.wikimedia.org/r/651506

Change 651506 merged by jenkins-bot:
[mediawiki/core@master] Add data attribute to the elements with class "history-size"

https://gerrit.wikimedia.org/r/651506