Skip to content

Commit 47a7f1f

Browse files
committed
Fix incorrect assignments content-mathml extension, and don't modify original document. Resolves issue #1575.
1 parent 4a9bee1 commit 47a7f1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

unpacked/extensions/MathML/content-mathml.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,9 +1317,11 @@ MathJax.Extension["MathML/content-mathml"] = (function(HUB) {
13171317
} else if (arg.nodeName === 'apply' && children.length === 2 && children[0].nodeName === 'minus') {
13181318
CToP.appendToken(mrow,'mo','\u2212');
13191319
CToP.applyTransform(mrow,children[1],2);
1320-
} else if (arg.nodeName === 'apply' && children.length>2 && children[0].nodeName === 'times' && children[1].nodeName === 'cn' && ( n = Number(CToP.getTextContent(children[1])) < 0)) {
1320+
} else if (arg.nodeName === 'apply' && children.length>2 && children[0].nodeName === 'times' && children[1].nodeName === 'cn' && (n = Number(CToP.getTextContent(children[1]))) < 0) {
13211321
CToP.appendToken(mrow,'mo','\u2212');
1322-
CToP.getTextContent(children[1]) = -n;// fix me: modifying document
1322+
arg = arg.cloneNode(true);
1323+
children = CToP.getChildren(arg);
1324+
children[1].textContent = -n;
13231325
CToP.applyTransform(mrow,arg,2);
13241326
} else{
13251327
CToP.appendToken(mrow,'mo','+');

0 commit comments

Comments
 (0)