Skip to content

Commit 6e442e3

Browse files
committed
Fix regression with HTML snippet preview. mathjax#557
1 parent 3922f0c commit 6e442e3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

unpacked/extensions/mml2jax.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,14 @@ MathJax.Extension.mml2jax = {
184184
createPreview: function (math,script) {
185185
var preview = this.config.preview;
186186
if (preview === "none") return;
187+
var isNodePreview = false;
187188
if (preview === "mathml") {
189+
isNodePreview = true;
188190
// mathml preview does not work with IE < 9, so fallback to alttext.
189191
if (this.MathTagBug) {preview = "alttext"} else {preview = math}
190192
}
191193
if (preview === "alttext" || preview === "altimg") {
194+
isNodePreview = true;
192195
var alttext = this.filterPreview(math.getAttribute("alttext"));
193196
if (preview === "alttext") {
194197
if (alttext != null) {preview = MathJax.HTML.TextNode(alttext)} else {preview = null}
@@ -202,8 +205,13 @@ MathJax.Extension.mml2jax = {
202205
}
203206
}
204207
if (preview) {
205-
var span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});
206-
span.appendChild(preview);
208+
var span;
209+
if (isNodePreview) {
210+
span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});
211+
span.appendChild(preview);
212+
} else {
213+
span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},preview);
214+
}
207215
script.parentNode.insertBefore(span,script);
208216
}
209217
},

0 commit comments

Comments
 (0)