Description
Issue Summary
MathML's <msubsup>
element is meant to contain three child elements that represent base, subscript and superscript. If the subscript is void and the superscript is filled-in, the superscript is still supposed to be treated as a superscript.
MathJax 3.2.0's output/chtml component seems to be prone to misrepresenting the msubsup
element's superscript as a subscript if the real subscript is void or empty. But not always :S.
It seems to be dependant on nearby elements and which elements are used inside msubsup
. In the reproduction steps below, I was able to provide examples that always render properly, always render improperly and one that renders differently depending on whether it precedes or follows other equations.
The input/mml and output/svg components seem to be unaffected. The accessibility extension always identifies superscripts correctly and the SVG renderer always renders them as such.
Steps to Reproduce:
JSBin examples:
- Cauchy-Schwarz Inequality, never works, always works
- Never works, always works, Cauchy-Schwarz Inequality
Expected outcome:
All superscripts are rendered as superscripts (top-aligned).
Actual outcome:
- The "Never works" example's superscript is rendered as a subscript (bottom-aligned).
- The "Always works" example's superscript is rendered as a superscript (top-aligned).
- The "2" superscript in the Cauchy-Schwarz Inequality appears as a subscript if that equation comes first.
- The "2" superscript in the Cauchy-Schwarz Inequality appears as a superscript if that equation comes last.
Technical details:
- MathJax Version: 3.2.0 (latest commit: 7146ffa)
- Client OS: Windows 10
- Browser: Edge 92.0.902.55, Firefox 92.0b9, Internet Explorer 11
Supporting information:
- MathJax 2.7.x is unaffected.
- Firefox's native MathML renderer is unaffected (although the issue does occur in that browser if MathJax 3.2.0 is used).
- This issue was first spotted in MathML polyfill: Update MathJax to ^3.2.0 wet-boew/wet-boew#9143:
- I tried updating MathJax 2.7.4 to 3.2.0's mml-chtml preset.
- @GormFrank noticed that it changed all of the superscripts in WET's MathML examples into subscripts.
- WET's MathML examples seem to be based on the complex1 examples from the W3C's MathML test suite.