Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<mtext>A&nbsp;</mtext> renders well in FF but fails in Chromium #3287

Closed
physikerwelt opened this issue Sep 20, 2024 · 3 comments
Closed

<mtext>A&nbsp;</mtext> renders well in FF but fails in Chromium #3287

physikerwelt opened this issue Sep 20, 2024 · 3 comments
Milestone

Comments

@physikerwelt
Copy link
Contributor

Replace the text below with the details of the issue you are facing.
DO NOT simply erase the form and type a free-form response.

Issue Summary

As described in https://phabricator.wikimedia.org/T375241 LaTeX input like $\text{A }$ creates the following rendering error in Chromium but renders fine in Firefox.

With a preprocessing script the LaTeX input is converted into MathML of this form

<mtext>A&nbsp;</mtext>

Is this the MathML representation the MathJax team recommends?

"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)"

Steps to Reproduce:

  1. Login to https://www.mediawiki.org/
  2. Select Client Side Math rendering in the preferences https://www.mediawiki.org/wiki/Special:Preferences#mw-prefsection-rendering-math
  3. Goto https://www.mediawiki.org/wiki/Extension:Math/T375241

See that it works with FF but fails with Chrome.

Technical details:

  • MathJax Version: 3.2.2
  • Client OS: Mac OS X 10.8.4
  • Browser: Chrome 131.0.6728.0

I am using the following MathJax configuration:

https://github.com/wikimedia/mediawiki-extensions-Math/blob/db81c960623d346ca8f43fb91ca3da92f868ea29/modules/ext.math.mathjax.js#L7

( function () {
	'use strict';
	const extensionAssetsPath = mw.config.get( 'wgExtensionAssetsPath' );
	window.MathJax = {
		loader: {
			// see https://docs.mathjax.org/en/latest/input/mathml.html
			load: [ '[mml]/mml3' ],
			// see https://docs.mathjax.org/en/latest/options/startup/loader.html
			paths: {
				mathjax: extensionAssetsPath + '/Math/modules/mathjax/es5'
			}
		}
	};
}() );

and loading MathJax via

<script src="/w/extensions/Math/modules/mathjax/es5/input/mml.js" charset="UTF-8"></script>
<script src="/w/extensions/Math/modules/mathjax/es5/input/mml/extensions/mml3.js" charset="UTF-8"></script>

Supporting information:

  • Please supply a link to a (live) minimal example page, when possible:

https://www.mediawiki.org/wiki/Extension:Math/T375241

  • If your issue is with the display of the mathematics produced by MathJax, include a screen snapshot that illustrates the problem, when possible.
    Screenshot 2024-09-20 at 12 17 03
    Screenshot 2024-09-20 at 12 16 42

  • Check your browser console window for any error messages, and include them here.

"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)"
  • Include the MathJax configuration you are using, and the script tag that loads MathJax itself.
			load: [ '[mml]/mml3' ],
@dpvc
Copy link
Member

dpvc commented Sep 20, 2024

This is a duplicate of #3030. WebKit and Blink seem to have difficulty processing the XSLT stylesheet used for the mml3 extension when the MathML contains &nbsp; entities. The code example given there should resolve the issue for you, though you might need to change inputJax[0] to inputJax[1] depending on how MathJax is loaded.

@dpvc dpvc added this to the v4.0 milestone Sep 20, 2024
@dpvc
Copy link
Member

dpvc commented Sep 20, 2024

PS, this is already fixed in v4 (now out in beta release).

@physikerwelt
Copy link
Contributor Author

Thank you. With your fix, we could fix the upstream but https://phabricator.wikimedia.org/T375241 in little time. This was very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants