Skip to content

Commit 78fce5d

Browse files
committed
Fix [Math Processing Error] objects to work with new menu code in 2.6.0.
1 parent 6000aa1 commit 78fce5d

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

unpacked/MathJax.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,8 @@ MathJax.Hub = {
23522352
if (err.line||err.lineNumber) message += "\n"+LOCALIZE("ErrorLine","line: %1",err.line||err.lineNumber);
23532353
message += "\n\n"+LOCALIZE("ErrorTips","Debugging tips: use %1, inspect %2 in the browser console","'unpacked/MathJax.js'","'MathJax.Hub.lastError'");
23542354
script.MathJax.error = MathJax.OutputJax.Error.Jax(message,script);
2355-
2355+
if (script.MathJax.elementJax)
2356+
script.MathJax.error.inputID = script.MathJax.elementJax.inputID;
23562357
//
23572358
// Create the [Math Processing Error] span
23582359
//
@@ -2361,28 +2362,23 @@ MathJax.Hub = {
23612362
var error = MathJax.HTML.Element("span", {
23622363
className:"MathJax_Error", jaxID:"Error", isMathJax:true,
23632364
id: script.MathJax.error.inputID+"-Frame"
2364-
},errorText);
2365+
},[["span",null,errorText]]);
23652366
//
23662367
// Attach the menu events
23672368
//
2368-
if (MathJax.Extension.MathEvents) {
2369-
var EVENT = MathJax.Extension.MathEvents.Event;
2369+
MathJax.Ajax.Require("[MathJax]/extensions/MathEvents.js",function () {
2370+
var EVENT = MathJax.Extension.MathEvents.Event
2371+
HUB = MathJax.Hub;
23702372
error.oncontextmenu = EVENT.Menu;
23712373
error.onmousedown = EVENT.Mousedown;
2372-
error.onkeydown = EVENT.Keydown;
2373-
error.tabIndex = this.getTabOrder(this.getJaxFor(script));
2374-
} else {
2375-
MathJax.Ajax.Require("[MathJax]/extensions/MathEvents.js",function () {
2376-
var EVENT = MathJax.Extension.MathEvents.Event;
2377-
error.oncontextmenu = EVENT.Menu;
2378-
error.onmousedown = EVENT.Mousedown;
2379-
error.keydown = EVENT.Keydown;
2380-
error.tabIndex = this.getTabOrder(this.getJaxFor(script));
2381-
});
2382-
}
2374+
error.keydown = EVENT.Keydown;
2375+
error.tabIndex = HUB.getTabOrder(HUB.getJaxFor(script));
2376+
});
23832377
//
23842378
// Insert the error into the page and remove any preview
23852379
//
2380+
var node = document.getElementById(error.id);
2381+
if (node) node.parentNode.removeChild(node);
23862382
script.parentNode.insertBefore(error,script);
23872383
if (script.MathJax.preview) {script.MathJax.preview.innerHTML = ""}
23882384
//

0 commit comments

Comments
 (0)