Fix isMathJaxNode() to work with NativeMML output and don't worry about tagName starting with 'mjx-' since CHTML doesn't do that anymore. Fix isJax() to call isMathJaxNode() properly. Remove isMathJaxNode() call from HashCheck(), since that is taken care of in getJaxFor() automatically. Resolves issue #1273.
This commit is contained in:
parent
60c69e1d1f
commit
90fdfd4783
|
@ -1982,6 +1982,7 @@ MathJax.Hub = {
|
||||||
if (typeof(element) === 'string') {element = document.getElementById(element)}
|
if (typeof(element) === 'string') {element = document.getElementById(element)}
|
||||||
if (element && element.MathJax) {return element.MathJax.elementJax}
|
if (element && element.MathJax) {return element.MathJax.elementJax}
|
||||||
if (this.isMathJaxNode(element)) {
|
if (this.isMathJaxNode(element)) {
|
||||||
|
if (!element.isMathJax) {element = element.firstChild} // for NativeMML output
|
||||||
while (element && !element.jaxID) {element = element.parentNode}
|
while (element && !element.jaxID) {element = element.parentNode}
|
||||||
if (element) {return MathJax.OutputJax[element.jaxID].getJaxFromMath(element)}
|
if (element) {return MathJax.OutputJax[element.jaxID].getJaxFromMath(element)}
|
||||||
}
|
}
|
||||||
|
@ -1990,7 +1991,7 @@ MathJax.Hub = {
|
||||||
|
|
||||||
isJax: function (element) {
|
isJax: function (element) {
|
||||||
if (typeof(element) === 'string') {element = document.getElementById(element)}
|
if (typeof(element) === 'string') {element = document.getElementById(element)}
|
||||||
if (this.isMathJaxNode(element.tagName)) {return 1}
|
if (this.isMathJaxNode(element)) {return 1}
|
||||||
if (element && (element.tagName||"").toLowerCase() === 'script') {
|
if (element && (element.tagName||"").toLowerCase() === 'script') {
|
||||||
if (element.MathJax)
|
if (element.MathJax)
|
||||||
{return (element.MathJax.state === MathJax.ElementJax.STATE.PROCESSED ? 1 : -1)}
|
{return (element.MathJax.state === MathJax.ElementJax.STATE.PROCESSED ? 1 : -1)}
|
||||||
|
@ -1999,7 +2000,7 @@ MathJax.Hub = {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
isMathJaxNode: function (element) {
|
isMathJaxNode: function (element) {
|
||||||
return !!element && (element.isMathJax || (element.tagName||"").substr(0,4) === "MJX-");
|
return !!element && (element.isMathJax || (element.className||"") === "MathJax_MathML");
|
||||||
},
|
},
|
||||||
|
|
||||||
setRenderer: function (renderer,type) {
|
setRenderer: function (renderer,type) {
|
||||||
|
@ -2672,11 +2673,9 @@ MathJax.Hub.Startup = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
HashCheck: function (target) {
|
HashCheck: function (target) {
|
||||||
if (this.isMathJaxNode(target)) {
|
|
||||||
var jax = MathJax.Hub.getJaxFor(target);
|
var jax = MathJax.Hub.getJaxFor(target);
|
||||||
if (jax && MathJax.OutputJax[jax.outputJax].hashCheck)
|
if (jax && MathJax.OutputJax[jax.outputJax].hashCheck)
|
||||||
{target = MathJax.OutputJax[jax.outputJax].hashCheck(target)}
|
{target = MathJax.OutputJax[jax.outputJax].hashCheck(target)}
|
||||||
}
|
|
||||||
return target;
|
return target;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user