[OutputTransform] Add data-mw-parsoid-version to wrapper div
commit7738554eee146ccc04508fd39d29d648bce88efc
authorC. Scott Ananian <cscott@cscott.net>
Wed, 24 Apr 2024 20:35:11 +0000 (24 16:35 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Mon, 29 Apr 2024 16:36:50 +0000 (29 12:36 -0400)
treee62bbaa9c33723aae674b627a55bcfe496cf3204
parent22b42ae35155fa58b0e5d7c18fb57880f14fe1f5
[OutputTransform] Add data-mw-parsoid-version to wrapper div

Adding a data-mw-parsoid-version attribute to the wrapper div helps to
unambiguously mark parsoid-generated output in a way which is compatible
with CSS rules and client-side JavaScript.

By embedding the current version of parsoid in the data attribute,
sophisticated CSS rules can match against a specific version of
Parsoid in order to facilitate proper behavior; for example:

    div[data-mw-parsoid-version^="0.20.0"]

This could be useful in deployment scenarios where the parser cache
might contain content generated by older or newer versions of Parsoid,
for roll-forward or roll-back deployment scenarios, respectively.

Bug: T363378
Change-Id: I941d31479eebb12ea1f4dcdb0a1737033ddc8ac1
includes/OutputTransform/Stages/AddWrapperDivClass.php
tests/phpunit/includes/api/ApiParseTest.php
tests/phpunit/includes/content/WikitextContentHandlerIntegrationTest.php