Page MenuHomePhabricator

Galleries on Parsoid don't support data attributes
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

  • Use <gallery data-test="123">Test.png</gallery>
  • Observe the DOM on the legacy parser to see it has data-test="123" on the <ul> element
  • Switch to Parsoid

What happens?: Parsoid does not emit data-test="123" on the <ul> element

What should have happened instead?: Parsoid should have emitted the attribute.

Other information: Parsoid calls Sanitizer::attributesAllowedInternal to retrieve a list of allowed attributes (which cannot account for allowed data attributes) instead of calling Sanitizer::sanitizeTagAttrs that accounts for data attributes.

Event Timeline

Change #1272870 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] [gallery] Use Sanitizer::sanitizeTagAttrs for args

https://gerrit.wikimedia.org/r/1272870

Change #1272870 merged by jenkins-bot:

[mediawiki/services/parsoid@master] [gallery] Use Sanitizer::sanitizeTagAttrs for args

https://gerrit.wikimedia.org/r/1272870

Change #1275470 had a related patch set uploaded (by OSleger; author: OSleger):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.23.0-a28

https://gerrit.wikimedia.org/r/1275470

Change #1275470 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.23.0-a28

https://gerrit.wikimedia.org/r/1275470

Change #1275541 had a related patch set uploaded (by C. Scott Ananian; author: OSleger):

[mediawiki/vendor@wmf/1.46.0-wmf.24] Bump wikimedia/parsoid to 0.23.0-a28

https://gerrit.wikimedia.org/r/1275541

Change #1275541 merged by jenkins-bot:

[mediawiki/vendor@wmf/1.46.0-wmf.24] Bump wikimedia/parsoid to 0.23.0-a28

https://gerrit.wikimedia.org/r/1275541

Mentioned in SAL (#wikimedia-operations) [2026-04-21T14:09:44Z] <cscott@deploy1003> Started scap sync-world: Backport for [[gerrit:1275541|Bump wikimedia/parsoid to 0.23.0-a28 (T420102 T421680 T422879 T422966 T423192 T423763 T423662)]], [[gerrit:1275542|Bump wikimedia/parsoid to 0.23.0-a28 (T423662)]], [[gerrit:1275560|[tests] add ParsoidLanguageConverterTest]], [[gerrit:1275561|ParsoidLanguageConverter: update lang/dir on content wrapper div (T423747)]]

Mentioned in SAL (#wikimedia-operations) [2026-04-21T14:11:25Z] <cscott@deploy1003> cscott: Backport for [[gerrit:1275541|Bump wikimedia/parsoid to 0.23.0-a28 (T420102 T421680 T422879 T422966 T423192 T423763 T423662)]], [[gerrit:1275542|Bump wikimedia/parsoid to 0.23.0-a28 (T423662)]], [[gerrit:1275560|[tests] add ParsoidLanguageConverterTest]], [[gerrit:1275561|ParsoidLanguageConverter: update lang/dir on content wrapper div (T423747)]] synced to the testservers (see https://wikit

Mentioned in SAL (#wikimedia-operations) [2026-04-21T14:22:46Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1275541|Bump wikimedia/parsoid to 0.23.0-a28 (T420102 T421680 T422879 T422966 T423192 T423763 T423662)]], [[gerrit:1275542|Bump wikimedia/parsoid to 0.23.0-a28 (T423662)]], [[gerrit:1275560|[tests] add ParsoidLanguageConverterTest]], [[gerrit:1275561|ParsoidLanguageConverter: update lang/dir on content wrapper div (T423747)]] (duration: 13m 02s)

Post-deploy, the <ul> element in Parsoid output now looks like,

<ul class="gallery mw-gallery-traditional" data-test="123" typeof="mw:Extension/gallery" about="#mwt1" data-mw="{&quot;name&quot;:&quot;gallery&quot;,&quot;attrs&quot;:{&quot;data-test&quot;:&quot;123&quot;},&quot;body&quot;:{}}" id="mwAg">

https://test.wikipedia.org/w/?oldid=737866&useparsoid=1