Remove namespaces (resolves issue #1238) and use createElementNS even in IE when possible (these nodes are temprary and never actually go into the DOM, so no need to trigger MathPlayer). I don't know if the m: is right for earlier IE, since element.nodeName may return that and cause the same problems as 1238. That should be checked.

This commit is contained in:
Davide P. Cervone 2015-08-10 18:37:43 -04:00
parent d566b9b8bc
commit 12bee3279d

View File

@ -93,6 +93,7 @@ MathJax.Extension["MathML/content-mathml"] = (function(HUB) {
/* Transform a Content MathML element into Presentation MathML, and return the new element
*/
transformElement: function(element) {
if (element.nodeName.indexOf(":") >= 0) element = CToP.cloneNode(element,true); // removes namespaces
var mathNode = CToP.cloneNode(element);
for (var j = 0, l = element.childNodes.length; j<l; j++ ) {
CToP.applyTransform(mathNode,element.childNodes[j],0);
@ -137,10 +138,10 @@ MathJax.Extension["MathML/content-mathml"] = (function(HUB) {
/* Create an element with given name, belonging to the MathML namespace
*/
createElement: function(name) {
var math = (isMSIE ? document.createElement("m:"+name) :
document.createElementNS("http://www.w3.org/1998/Math/MathML",name));
math.isMathJax = true;
return math;
name = name.replace(/^.*:/,""); // remove namespace
return (document.createElementNS ?
document.createElementNS("http://www.w3.org/1998/Math/MathML",name) :
document.createElement("m:"+name));
},
/* Get node's children