Make a separate routine to get the contents of a script, and make it work in IE for XHTML files.

This commit is contained in:
Davide P. Cervone 2012-02-10 08:21:42 -05:00
parent a8e844c1e7
commit 1698f9c33c
22 changed files with 38 additions and 39 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -981,7 +981,7 @@ MathJax.HTML = {
addText: function (span,text) {return span.appendChild(this.TextNode(text))},
//
// Set the text of a script
// Set and get the text of a script
//
setScript: function (script,text) {
if (this.setScriptBug) {script.text = text} else {
@ -989,6 +989,10 @@ MathJax.HTML = {
this.addText(script,text);
}
},
getScript: function (script) {
var text = (script.text === "" ? script.innerHTML : script.text);
return text.replace(/^\s+/,"").replace(/\s+$/,"");
},
//
// Manage cookies
@ -2111,7 +2115,7 @@ MathJax.Hub.Startup = {
},
needsUpdate: function (jax) {
var script = jax.SourceElement();
return (jax.originalText !== (script.text == "" ? script.innerHTML : script.text));
return (jax.originalText !== BASE.HTML.getScript(script));
},
Register: function (mimetype) {
if (!HUB.inputJax) {HUB.inputJax = {}}
@ -2201,7 +2205,7 @@ MathJax.Hub.Startup = {
if (script.id) {this.inputID = script.id}
else {script.id = this.inputID = BASE.ElementJax.GetID(); this.newID = 1}
}
jax.originalText = (script.text == "" ? script.innerHTML : script.text);
jax.originalText = BASE.HTML.getScript(script);
jax.inputJax = inputJax;
if (jax.root) {jax.root.inputID = jax.inputID}
return jax;

View File

@ -1258,7 +1258,7 @@ junk = null;
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing AsciiMath
Translate: function (script) {
var mml, math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
var mml, math = MathJax.HTML.getScript(script);
var data = {math:math, script:script};
this.prefilterHooks.Execute(data); math = data.math;
try {

View File

@ -206,10 +206,8 @@
data.math = script.firstChild;
this.prefilterHooks.Execute(data); math = data.math;
} else {
math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
math = MathJax.HTML.getScript(script);
if (BROWSER.isMSIE) {math = math.replace(/( )+$/,"")}
else if (BROWSER.isKonqueror)
{math = math.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}
data.math = math; this.prefilterHooks.Execute(data); math = data.math;
}
try {

View File

@ -1980,7 +1980,7 @@
// Convert TeX to ElementJax
//
Translate: function (script) {
var mml, isError = false, math = script.innerHTML.replace(/^\s+/,"").replace(/\s+$/,"");
var mml, isError = false, math = MathJax.HTML.getScript(script);
var display = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*display(;|\s|\n|$)/) != null);
var data = {math:math, display:display, script:script};
this.prefilterHooks.Execute(data); math = data.math;
@ -1999,9 +1999,6 @@
return data.math;
},
prefilterMath: function (math,displaystyle,script) {
// Konqueror incorrectly quotes these characters in script.innerHTML
if (HUB.Browser.isKonqueror)
{math = math.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}
return math;
},
postfilterMath: function (math,displaystyle,script) {