Work around IE10 bug with document.namespace, and with the background color for the contextual menu (resolves issues #203 and #204)
This commit is contained in:
parent
93e68cc254
commit
4d717dbea4
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
|
@ -12,5 +12,5 @@
|
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Extension.mml2jax={version:"2.0",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d,b;if(document.namespaces){for(d=0,b=document.namespaces.length;d<b;d++){var f=document.namespaces[d];if(f.urn===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(f.name+":math"))}}}else{var c=document.getElementsByTagName("html")[0];if(c){for(d=0,b=c.attributes.length;d<b;d++){var a=c.attributes[d];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.MathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.ProcessMathFlattened(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.AttributeBug){var b=this.OuterHTML(e);if(this.CleanupHTML){b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");b=b.replace(/ /g," ")}MathJax.HTML.setScript(a,b);d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},ProcessMathFlattened:function(f){var d=f.parentNode;var b=document.createElement("script");b.type="math/mml";d.insertBefore(b,f);var c="",e,a=f;while(f&&f.nodeName!=="/MATH"){e=f;f=f.nextSibling;c+=this.NodeHTML(e);e.parentNode.removeChild(e)}if(f&&f.nodeName==="/MATH"){f.parentNode.removeChild(f)}b.text=c+"</math>";if(this.config.preview!=="none"){this.createPreview(a,b)}},NodeHTML:function(e){var c,b,a;if(e.nodeName==="#text"){c=this.quoteHTML(e.nodeValue)}else{if(e.nodeName==="#comment"){c="<!--"+e.nodeValue+"-->"}else{c="<"+e.nodeName.toLowerCase();for(b=0,a=e.attributes.length;b<a;b++){var d=e.attributes[b];if(d.specified){c+=" "+d.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"=";var f=d.nodeValue;if(f==null&&d.nodeName==="style"&&e.style){f=e.style.cssText}c+='"'+this.quoteHTML(f)+'"'}}c+=">";if(e.outerHTML!=null&&e.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)){for(b=0,a=e.childNodes.length;b<a;b++){c+=this.OuterHTML(e.childNodes[b])}c+="</"+e.nodeName.toLowerCase()+">"}}}return c},OuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.NodeHTML(d)}if(!this.AttributeBug){return d.outerHTML}var c=this.NodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.OuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},quoteHTML:function(a){if(a==null){a=""}return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterPreview(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterPreview:function(a){return a},InitBrowser:function(){var b=MathJax.HTML.Element("span",{id:"<",className:"mathjax",innerHTML:"<math><mi>x</mi><mspace /></math>"});var a=b.outerHTML||"";this.AttributeBug=a!==""&&!(a.match(/id="<"/)&&a.match(/class="mathjax"/)&&a.match(/<\/math>/));this.MathTagBug=b.childNodes.length>1;this.CleanupHTML=MathJax.Hub.Browser.isMSIE}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");
|
||||
MathJax.Extension.mml2jax={version:"2.0.1",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d,b;if(typeof(document.namespaces)!=="undefined"){try{for(d=0,b=document.namespaces.length;d<b;d++){var f=document.namespaces[d];if(f.urn===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(f.name+":math"))}}}catch(g){}}else{var c=document.getElementsByTagName("html")[0];if(c){for(d=0,b=c.attributes.length;d<b;d++){var a=c.attributes[d];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.MathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.ProcessMathFlattened(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.AttributeBug){var b=this.OuterHTML(e);if(this.CleanupHTML){b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");b=b.replace(/ /g," ")}MathJax.HTML.setScript(a,b);d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},ProcessMathFlattened:function(f){var d=f.parentNode;var b=document.createElement("script");b.type="math/mml";d.insertBefore(b,f);var c="",e,a=f;while(f&&f.nodeName!=="/MATH"){e=f;f=f.nextSibling;c+=this.NodeHTML(e);e.parentNode.removeChild(e)}if(f&&f.nodeName==="/MATH"){f.parentNode.removeChild(f)}b.text=c+"</math>";if(this.config.preview!=="none"){this.createPreview(a,b)}},NodeHTML:function(e){var c,b,a;if(e.nodeName==="#text"){c=this.quoteHTML(e.nodeValue)}else{if(e.nodeName==="#comment"){c="<!--"+e.nodeValue+"-->"}else{c="<"+e.nodeName.toLowerCase();for(b=0,a=e.attributes.length;b<a;b++){var d=e.attributes[b];if(d.specified){c+=" "+d.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"=";var f=d.nodeValue;if(f==null&&d.nodeName==="style"&&e.style){f=e.style.cssText}c+='"'+this.quoteHTML(f)+'"'}}c+=">";if(e.outerHTML!=null&&e.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)){for(b=0,a=e.childNodes.length;b<a;b++){c+=this.OuterHTML(e.childNodes[b])}c+="</"+e.nodeName.toLowerCase()+">"}}}return c},OuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.NodeHTML(d)}if(!this.AttributeBug){return d.outerHTML}var c=this.NodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.OuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},quoteHTML:function(a){if(a==null){a=""}return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterPreview(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterPreview:function(a){return a},InitBrowser:function(){var b=MathJax.HTML.Element("span",{id:"<",className:"mathjax",innerHTML:"<math><mi>x</mi><mspace /></math>"});var a=b.outerHTML||"";this.AttributeBug=a!==""&&!(a.match(/id="<"/)&&a.match(/class="mathjax"/)&&a.match(/<\/math>/));this.MathTagBug=b.childNodes.length>1;this.CleanupHTML=MathJax.Hub.Browser.isMSIE}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ if (!window.MathJax) {window.MathJax= {}}
|
|||
if (!MathJax.Hub) { // skip if already loaded
|
||||
|
||||
MathJax.version = "2.0";
|
||||
MathJax.fileversion = "2.0.2";
|
||||
MathJax.fileversion = "2.0.3";
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
|
@ -2388,24 +2388,26 @@ MathJax.Hub.Startup = {
|
|||
browser.isIE9 = !!(document.documentMode && (window.performance || window.msPerformance));
|
||||
MathJax.HTML.setScriptBug = !browser.isIE9 || document.documentMode < 9;
|
||||
var MathPlayer = false;
|
||||
try {new ActiveXObject("MathPlayer.Factory.1"); MathPlayer = true} catch(err) {}
|
||||
if (MathPlayer && !STARTUP.params.NoMathPlayer) {
|
||||
var mathplayer = document.createElement("object");
|
||||
mathplayer.id = "mathplayer"; mathplayer.classid = "clsid:32F66A20-7614-11D4-BD11-00104BD3F987";
|
||||
document.getElementsByTagName("head")[0].appendChild(mathplayer);
|
||||
document.namespaces.add("m","http://www.w3.org/1998/Math/MathML");
|
||||
browser.hasMathPlayer = true;
|
||||
if (document.readyState && (document.readyState === "loading" ||
|
||||
document.readyState === "interactive")) {
|
||||
document.write('<?import namespace="m" implementation="#MathPlayer">');
|
||||
browser.mpImported = true;
|
||||
try {new ActiveXObject("MathPlayer.Factory.1"); MathPlayer = true} catch (err) {}
|
||||
try {
|
||||
if (MathPlayer && !STARTUP.params.NoMathPlayer) {
|
||||
var mathplayer = document.createElement("object");
|
||||
mathplayer.id = "mathplayer"; mathplayer.classid = "clsid:32F66A20-7614-11D4-BD11-00104BD3F987";
|
||||
document.getElementsByTagName("head")[0].appendChild(mathplayer);
|
||||
document.namespaces.add("m","http://www.w3.org/1998/Math/MathML");
|
||||
browser.hasMathPlayer = true;
|
||||
if (document.readyState && (document.readyState === "loading" ||
|
||||
document.readyState === "interactive")) {
|
||||
document.write('<?import namespace="m" implementation="#MathPlayer">');
|
||||
browser.mpImported = true;
|
||||
}
|
||||
} else {
|
||||
// Adding any namespace avoids a crash in IE9 in IE9-standards mode
|
||||
// (any reference to document.namespaces before document.readyState is
|
||||
// "complete" causes an "unspecified error" to be thrown)
|
||||
document.namespaces.add("mjx_IE_fix","http://www.w3.org/1999/xlink");
|
||||
}
|
||||
} else {
|
||||
// Adding any namespace avoids a crash in IE9 in IE9-standards mode
|
||||
// (any reference to document.namespaces before document.readyState is
|
||||
// "complete" causes an "unspecified error" to be thrown)
|
||||
document.namespaces.add("mjx_IE_fix","http://www.w3.org/1999/xlink");
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
});
|
||||
HUB.Browser.Select(MathJax.Message.browsers);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
(function (HUB,HTML,AJAX,CALLBACK,OUTPUT) {
|
||||
var VERSION = "2.0.1";
|
||||
var VERSION = "2.0.2";
|
||||
|
||||
var SIGNAL = MathJax.Callback.Signal("menu") // signal for menu events
|
||||
|
||||
|
@ -866,7 +866,7 @@
|
|||
var isIE8 = browser.versionAtLeast("8.0") && document.documentMode > 7;
|
||||
MENU.Augment({
|
||||
margin: 20,
|
||||
msieBackgroundBug: true,
|
||||
msieBackgroundBug: (document.documentMode < 9),
|
||||
msieFixedPositionBug: (quirks || !isIE8),
|
||||
msieAboutBug: quirks
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
MathJax.Extension.mml2jax = {
|
||||
version: "2.0",
|
||||
version: "2.0.1",
|
||||
config: {
|
||||
preview: "alttext" // Use the <math> element's alttext as the
|
||||
// preview. Set to "none" for no preview,
|
||||
|
@ -56,15 +56,17 @@ MathJax.Extension.mml2jax = {
|
|||
// Handle math with namespaces in HTML
|
||||
//
|
||||
var i, m;
|
||||
if (document.namespaces) {
|
||||
if (typeof(document.namespaces) !== "undefined") {
|
||||
//
|
||||
// IE namespaces are listed in document.namespaces
|
||||
//
|
||||
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"))}
|
||||
}
|
||||
try {
|
||||
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"))}
|
||||
}
|
||||
} catch (err) {}
|
||||
} else {
|
||||
//
|
||||
// Everybody else
|
||||
|
|
Loading…
Reference in New Issue
Block a user