Page MenuHomePhabricator

<math>\text{A }</math> with a space inside in Client Side MathJax mode give math input error
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Set preference to Client side MathJax
  • Enter a formula with a space as last character inside a \text tag <math>\text{A }</math> or as the first character <math>\text{ A}</math>
  • Save the file

What happens?:

"Math input error" is displayed, red text on yellow background

What should have happened instead?:

Formula is display correctly

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Chrome 128

Details

Event Timeline

@SalixAlba Thank you, but I could not reproduce this on https://www.mediawiki.org/wiki/Extension:Math/T375241 Can you check if you see the issue there?

Its only a bug when the client-side MathJax mode is selected. It fails for me at https://www.mediawiki.org/wiki/Extension:Math/T375241

image.png (279×1 px, 56 KB)

Just checking I had some custom css on mediawiki.org, clearing all local customisation gives

image.png (357×1 px, 49 KB)

When I use client-side MathJax with Firefox I see

Screenshot 2024-09-20 at 10-44-04 Extension Math_T375241 - MediaWiki.png (22×948 px, 7 KB)

only with Chrome, I can reproduce the problem. Interesting.

When you click on the error, and select show original MathML it says <merror data-mjx-error="Cannot read properties of null (reading 'getElementsByTagName')" title="Cannot read properties of null (reading 'getElementsByTagName')">

From the stack

"TypeError: Cannot read properties of null (reading 'getElementsByTagName')\n    at e.tags (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:9238)\n    at e.transform (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/input/mml/extensions/mml3.js:1:2952)\n    at e.mmlFilter (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/input/mml/extensions/mml3.js:1:3057)\n    at e.execute (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:731579)\n    at t.executeFilters (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:36695)\n    at e.compile (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/input/mml.js:1:2287)\n    at t.compile (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:49304)\n    at t.compileMath (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:44016)\n    at t.compile (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:43529)\n    at Object.renderDoc (https://www.mediawiki.org/w/extensions/Math/modules/mathjax/es5/tex-chtml.js?1d4e3:1:39265)"

In Firefox the same button reveals <mtext>A&nbsp;</mtext> which is the expected output.

I'm not sure what to do about this. Maybe, I file an upstream issue to MathJax?

It is quite an important bug, it breaks quite a lot, like most instances of \begin{cases}. An upstream bug would be good.

Change #1074497 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/extensions/Math@master] Workaround for WebKit XSLT issue

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

Change #1074497 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Workaround for WebKit XSLT issue

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