As part of T88290, we are going to be making some changes to the data-mw spec for <ref> tags.

So far, the data-mw attribute for <ref> tags had the entire HTML for the reference represented in the body.html property in data-mw. However, in order to reduce the size of the HTML that we generate (and reduce network load and parsing load on clients, especially visual editor), we have been working on a change where we add a reference to the HTML via the body.id attribute in data-mw.

https://gerrit.wikimedia.org/r/#/c/191593/ is the patch that Marc has been working on.

An example at the end of this email will show the specific change and how it looks. We will update the DOM spec page[1] shortly.

So, once this patch is reviewed, tested, and deployed (most likely Feb 25 or Mar 2 unless there are concerns / problems that show up), Parsoid will only be emitting an id-based reference to the HTML. However, Parsoid will continue to accept both data-mw.body.html and data-mw.body.id for serialization.

That said, because of the specifics of Parsoid's selective serializer implementation. if a <ref>'s content has been edited, Parsoid expects to see *some* edit in the wrapper HTML of the <ref> itself. If you continue to send Parsoid data-mw.body.html back, all will work fine (since that will register as an edit). But, if you send Parsoid data-mw.body.id back, you should change the value of that id to a different value.

This update is a bit late in coming -- kind of lost track of it amidst the work, but as far as we know, only VE is affected by this change and they have already fixed their code. Flow has confirmed they aren't. But, let us know if there are any questions / concerns.

Subbu and Marc.

[1] https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec

--------------------------------------------------------------------------------------------------------------------------------------------------------

Wikitext
--------
A <ref>
 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
</ref>

<references />

Current HTML
------------
<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>

<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
</li>
</ol>

New HTML
--------
<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id": "mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>

<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span> </span>
</li>
</ol>