Fix regression with HTML snippet preview. #557
This commit is contained in:
parent
3922f0c07c
commit
6e442e36bd
|
@ -184,11 +184,14 @@ MathJax.Extension.mml2jax = {
|
||||||
createPreview: function (math,script) {
|
createPreview: function (math,script) {
|
||||||
var preview = this.config.preview;
|
var preview = this.config.preview;
|
||||||
if (preview === "none") return;
|
if (preview === "none") return;
|
||||||
|
var isNodePreview = false;
|
||||||
if (preview === "mathml") {
|
if (preview === "mathml") {
|
||||||
|
isNodePreview = true;
|
||||||
// mathml preview does not work with IE < 9, so fallback to alttext.
|
// mathml preview does not work with IE < 9, so fallback to alttext.
|
||||||
if (this.MathTagBug) {preview = "alttext"} else {preview = math}
|
if (this.MathTagBug) {preview = "alttext"} else {preview = math}
|
||||||
}
|
}
|
||||||
if (preview === "alttext" || preview === "altimg") {
|
if (preview === "alttext" || preview === "altimg") {
|
||||||
|
isNodePreview = true;
|
||||||
var alttext = this.filterPreview(math.getAttribute("alttext"));
|
var alttext = this.filterPreview(math.getAttribute("alttext"));
|
||||||
if (preview === "alttext") {
|
if (preview === "alttext") {
|
||||||
if (alttext != null) {preview = MathJax.HTML.TextNode(alttext)} else {preview = null}
|
if (alttext != null) {preview = MathJax.HTML.TextNode(alttext)} else {preview = null}
|
||||||
|
@ -202,8 +205,13 @@ MathJax.Extension.mml2jax = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preview) {
|
if (preview) {
|
||||||
var span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});
|
var span;
|
||||||
|
if (isNodePreview) {
|
||||||
|
span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});
|
||||||
span.appendChild(preview);
|
span.appendChild(preview);
|
||||||
|
} else {
|
||||||
|
span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},preview);
|
||||||
|
}
|
||||||
script.parentNode.insertBefore(span,script);
|
script.parentNode.insertBefore(span,script);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user