Here's a simple manual test that fails,
!! test Selser is broken on native galleries !! options parsoid= { "modes": ["selser"], "changes": [ ["div.gallerytext", "contents", "text", "456"] ] } !! wikitext <gallery> File:Foobar.jpg|123 </gallery> !! wikitext/edited <gallery> File:Foobar.jpg|456 </gallery> !! end
where the changes get applied,
INPUT: <body data-parsoid='{"dsr":[0,40,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-parsoid='{"dsr":[0,40,9,10]}' data-mw='{"name":"gallery","attrs":{},"body":{}}'> <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">456</div></li> </ul></body>
but disappear in the output.
Refs has special support in DOMDiff for HTML editing them,
https://github.com/wikimedia/parsoid/blob/master/lib/html2wt/DOMDiff.js#L115-L148
but the gallery extension is treated like any other extension and isn't recursed into,
https://github.com/wikimedia/parsoid/blob/master/lib/html2wt/DOMDiff.js#L359-L368
Things worked in production because we previously asked VE to drop the "extsrc" and "caption" from data-mw when editing the HTML,
https://www.mediawiki.org/w/index.php?title=Specs/HTML/2.0.0/Extensions/Gallery&type=revision&diff=3065335&oldid=3065332&diffmode=source
which was enough for the DOMDiff algorithm to indicate that the node should be serialized from the HTML,
https://github.com/wikimedia/parsoid/blob/master/lib/html2wt/DOMDiff.js#L82
Recently, Parsoid stopped emitting the "extsrc",
https://github.com/wikimedia/parsoid/commit/e748b8ec831bf6c86487ca8e551274d62be16b1d .
Reverted in https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/486395
so you'd think editing would be impossible since there's no longer wrapper change, however, VE's output differs slightly for the input, enough so that selser is never applied to galleries,
In,
<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw="{"name":"gallery","attrs":{},"body":{}}" id="mwAg"> <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Test.jpg"><img resource="./File:Test.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/120px-Name.jpg" data-file-width="350" data-file-height="210" data-file-type="bitmap" height="72" width="120" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/240px-Name.jpg 2x, //upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/180px-Name.jpg 1.5x"></a></figure-inline></div><div class="gallerytext">123</div></li> </ul> <p id="mwAw">456</p></body>
Out,
<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery" typeof="mw:Extension/gallery" data-mw="{"name":"gallery","attrs":{},"body":{}}" about="#mwt3" id="mwAg"><li class="gallerybox"><div><div class="thumb"><div><a><img resource="File:Test.jpg" src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/200px-Name.jpg"></a></div></div></div><div class="gallerytext">1234</div></li></ul> <p id="mwAw">456</p></body>
The class list changed. A separate bug is filed for that in T214649.