DefaultEntityLinkFormatter adds labels to links to entities on special pages and summaries. The HTML usually looks like:
<a href="/wiki/Q12345" class="mw-changeslist-title" title="label | description"> <span class="wb-itemlink"> <span class="wb-itemlink-label" dir="dir" lang="lang">label</span> <span class="wb-itemlink-id">(Q12345)</span> </span> </a>
which looks like:
label (Q12345).
If there's no label, the link has HTML like:
<a href="/wiki/Q12345" class="mw-changeslist-title" title="Q12345"> <span class="wb-itemlink"> <span class="wb-itemlink-label" dir="dir" lang="lang"></span> <span class="wb-itemlink-id">(Q12345)</span> </span> </a>
and displays: _(Q12345) ("_" is normal space).
Notice that the first nested <span> is empty and the link has unexpected whitespace at the beginning.
I think this should be improved. Several possibilities come to my mind:
- fill the empty span with a placeholder text like "no label (Q12345)" (modules on Wikidata do this)
- make the content of wb-itemlink-id the only text of the whole link
- only show wb-itemlink-id, remove the empty tag