Page MenuHomePhabricator

Remove `alt=` prefix from Parsoid data-mw.attrs representation of media alt options.
Open, HighPublic

Description

See parent task.

For media like:

$ echo '[[File:Foo.jpg|thumb|alt=-{raw1}-|title=-{raw2}-|-{caption}-]]' | php bin/parse.php --domain=zh.wikipedia.org

Parsoid generates:

<figure data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&apos;{\"fl\":[],\"src\":\"-{raw1}-\",\"dsr\":[25,33,2,2]}&apos; data-mw-variant=&apos;{\"disabled\":{\"t\":\"raw1\"}}&apos;>&lt;/span>","txt":""}]]}'...>...</figure>

Note that the data-mw.attribs for the alt is both (a) on the wrong tag (the wrapper span, not the img) and (b) contains a bogus alt= prefix.

We're not going to fix (a) in this task, but we can fix (b). We expect that no one is actually using the value of data-mw.attribs here (need to double check VisualEditor) and so it won't cause any problems to remove the unnecessary/incorrect prefix.

Event Timeline

MSantos triaged this task as High priority.Mar 5 2026, 3:21 PM

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

[mediawiki/services/parsoid@master] Add rich value for `alt` attribute on `img` nodes

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