From 44ee2cf7621ac35716d442454d889edfb89ee9ed Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Tue, 24 Jun 2014 17:23:14 -0400 Subject: [PATCH] Don't remove entities or newlines from elements. Resolves issue #847. --- unpacked/jax/input/MathML/jax.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js index a97d9ceec..edd09d01c 100644 --- a/unpacked/jax/input/MathML/jax.js +++ b/unpacked/jax/input/MathML/jax.js @@ -158,8 +158,12 @@ if (child.nodeName === "#comment") continue; if (child.nodeName === "#text") { if ((mml.isToken || mml.isChars) && !mml.mmlSelfClosing) { - var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); - mml.Append(MML.chars(this.trimSpace(text))); + var text = child.nodeValue; + if (mml.isToken) { + text = text.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); + text = this.trimSpace(text); + } + mml.Append(MML.chars(text)); } else if (child.nodeValue.match(/\S/)) { MATHML.Error(["UnexpectedTextNode", "Unexpected text node: %1","'"+child.nodeValue+"'"]);