Page MenuHomePhabricator

MathJax displays raw HTML for <math> inside attributes
Closed, ResolvedPublic

Description

Test the following code with MathJax:

<span title="<math>x^2</math>"><math>x^2</math></span>

[Q: Why should anyone put <math> inside a title attribute?
A: Some templates for citing books use micro-formats, so this

actually does happen.]

This is shown as

<spanclass="tex"dir="ltr">$x2$</span>

In PNG-mode the output looks correct.


Version: unspecified
Severity: normal

Details

Reference
bz41677

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 1:05 AM
bzimport added a project: Math.
bzimport set Reference to bz41677.
bzimport added a subscriber: Unknown Object (MLST).
Schnark created this task.Nov 2 2012, 8:26 AM
TheDJ added a comment.Nov 2 2012, 10:54 AM

After Math extensions parser hook, the output becomes:

<span class="tex"><span class="tex" dir="ltr">$ x^2 $</span></span>

possibly there is some Tidy cleanup going on as well. This might 'work' with image mode, but such is pure accidental:

PNG mode:
<span class="tex"><img class="tex hide-images-handled" alt="x^2" src="//upload.wikimedia.org/math/c/6/6/c66452631491acdbf8e5ed69dfd19681.png"></span>

What about using $(node).text() instead of node.innerHTML in the ConvertMath function in modules/MathJax/extensions/wiki2jax.js? That way it should at least display correctly.

Related URL: https://gerrit.wikimedia.org/r/61252 (Gerrit Change I997fc5e87b320879c99f7560fb023876ab6ef573)

https://gerrit.wikimedia.org/r/61252 (Gerrit Change I997fc5e87b320879c99f7560fb023876ab6ef573) | change APPROVED and MERGED [by jenkins-bot]