Parsoid domToWikitext relies on Cite's AnchorFormatter::getNoteTextIdentifier to give reference list item content span an id like mw-reference-text-<normalized-name>-<global-sequence> for named refs or just mw-reference-text-<global-sequence> for unnamed refs, where the reference name has been normalized in a non-reversible way and the global sequence is an integer not indexed anywhere else. Sub-references point to these items by data-mw.mainBody which is used to get the main footnote body when serializing a main+details ref tag as wikitext. Currently, this ID is stored in MWReferenceNode as refListItemId.
This task is about designing and implementing a better ID or other DOM selector—for example by using the reference number to identify refs, since this is a piece of unique and well-formed data which is known at the time of usage: mw-reference-text-<group-name>-<footnote-number>
DOM ID should support any character except whitespace, so we may need to use a 1:1 mapping on group name such as URL escaping.
Note that the reflist item ID is currently used in several places:
- Anchor target for footnote marker links
- Parsoid domToWikitext
- Reference Previews
- Mobile ref previews