Try to fix test failures #557.
This commit is contained in:
parent
412d3669d1
commit
aad3a6edc2
|
@ -49,15 +49,16 @@ MathJax.Extension.mml2jax = {
|
|||
}
|
||||
if (typeof(element) === "string") {element = document.getElementById(element)}
|
||||
if (!element) {element = document.body}
|
||||
var mathArray = [];
|
||||
//
|
||||
// Handle all math tags with no namespaces
|
||||
//
|
||||
this.ProcessMathArray(element.getElementsByTagName("math"));
|
||||
this.AppendMathElements(mathArray,element.getElementsByTagName("math"));
|
||||
//
|
||||
// Handle math with namespaces in XHTML
|
||||
//
|
||||
if (element.getElementsByTagNameNS)
|
||||
{this.ProcessMathArray(element.getElementsByTagNameNS(this.MMLnamespace,"math"))}
|
||||
{this.AppendMathElements(mathArray,element.getElementsByTagNameNS(this.MMLnamespace,"math"))}
|
||||
//
|
||||
// Handle math with namespaces in HTML
|
||||
//
|
||||
|
@ -70,7 +71,7 @@ MathJax.Extension.mml2jax = {
|
|||
for (i = 0, m = document.namespaces.length; i < m; i++) {
|
||||
var ns = document.namespaces[i];
|
||||
if (ns.urn === this.MMLnamespace)
|
||||
{this.ProcessMathArray(element.getElementsByTagName(ns.name+":math"))}
|
||||
{this.AppendMathElements(mathArray,element.getElementsByTagName(ns.name+":math"))}
|
||||
}
|
||||
} catch (err) {}
|
||||
} else {
|
||||
|
@ -82,12 +83,19 @@ MathJax.Extension.mml2jax = {
|
|||
for (i = 0, m = html.attributes.length; i < m; i++) {
|
||||
var attr = html.attributes[i];
|
||||
if (attr.nodeName.substr(0,6) === "xmlns:" && attr.nodeValue === this.MMLnamespace)
|
||||
{this.ProcessMathArray(element.getElementsByTagName(attr.nodeName.substr(6)+":math"))}
|
||||
{this.AppendMathElements(mathArray,element.getElementsByTagName(attr.nodeName.substr(6)+":math"))}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ProcessMathArray(mathArray);
|
||||
},
|
||||
|
||||
AppendMathElements: function(mathArray, math) {
|
||||
if (math.length) {
|
||||
for (var i = math.length-1; i >= 0; i--) {mathArray.push(math[i])}
|
||||
}
|
||||
},
|
||||
|
||||
ProcessMathArray: function (math) {
|
||||
var i;
|
||||
if (math.length) {
|
||||
|
@ -104,6 +112,7 @@ MathJax.Extension.mml2jax = {
|
|||
|
||||
ProcessMath: function (math) {
|
||||
var parent = math.parentNode;
|
||||
if (!parent || parent.className === "MathJax_Preview") return;
|
||||
var script = document.createElement("script");
|
||||
script.type = "math/mml";
|
||||
parent.insertBefore(script,math);
|
||||
|
@ -123,6 +132,7 @@ MathJax.Extension.mml2jax = {
|
|||
|
||||
ProcessMathFlattened: function (math) {
|
||||
var parent = math.parentNode;
|
||||
if (!parent || parent.className === "MathJax_Preview") return;
|
||||
var script = document.createElement("script");
|
||||
script.type = "math/mml";
|
||||
parent.insertBefore(script,math);
|
||||
|
@ -188,7 +198,7 @@ MathJax.Extension.mml2jax = {
|
|||
if (preview === "mathml") {
|
||||
isNodePreview = true;
|
||||
// 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.cloneNode(false)}
|
||||
}
|
||||
if (preview === "alttext" || preview === "altimg") {
|
||||
isNodePreview = true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user