Page MenuHomePhabricator

Fix incorrect child counts in MathML for some elements
Closed, ResolvedPublic

Description

Firefox reports several parse errors in the mathml in

https://en.wikipedia.beta.wmflabs.org/wiki/Help:MathTestNative

Error in parsing the value '' for 'columnspacing' attribute of <mtable/>. Attribute ignored.Invalid markup: Incorrect number of children for <munder/> tag. Help:MathTestNative
Invalid markup: Incorrect number of children for <msup/> tag. Help:MathTestNative
Invalid markup: Incorrect number of children for <munder/> tag. Help:MathTestNative
Invalid markup: Incorrect number of children for <msup/> tag. Help:MathTestNative
Invalid markup: Incorrect number of children for <munder/> tag. node.js:370:30
Invalid markup: Incorrect number of children for <msup/> tag. node.js:370:30
Invalid markup: Incorrect number of children for <munder/> tag. node.js:370:30
Invalid markup: Incorrect number of children for <msup/> tag. node.js:370:30
Invalid markup: Incorrect number of children for <munder/> tag. utils.js:166:21
From the feedback:

A typical cause of the incorrect child count is empty tex groups.

For example the slightly nonsensical example

\underset{\mathrm{def}}{}

on the page is producing an <munder> with just one child. The mathml could be simplified simply removing the munder (corresponding to correcting the tex to \mathrm{def} without the spurious \underset) or if you want to model the tex exactly you need an empty <mrow/> (or <mi/> to match the empty tex argument so that <munder> has two children.

Event Timeline

Change 969149 had a related patch set uploaded (by Stegmujo; author: Stegmujo):

[mediawiki/extensions/Math@master] Fix Math Tag Imbalance

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

Stegmujo renamed this task from Fix Math Tag Imbalance to Fix incorrect child counts in MathML for some elements.Oct 26 2023, 3:06 PM

Change 969149 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Fix incorrect child count of some element

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

Physikerwelt assigned this task to Stegmujo.