@@ -2352,7 +2352,8 @@ MathJax.Hub = {
2352
2352
if ( err . line || err . lineNumber ) message += "\n" + LOCALIZE ( "ErrorLine" , "line: %1" , err . line || err . lineNumber ) ;
2353
2353
message += "\n\n" + LOCALIZE ( "ErrorTips" , "Debugging tips: use %1, inspect %2 in the browser console" , "'unpacked/MathJax.js'" , "'MathJax.Hub.lastError'" ) ;
2354
2354
script . MathJax . error = MathJax . OutputJax . Error . Jax ( message , script ) ;
2355
-
2355
+ if ( script . MathJax . elementJax )
2356
+ script . MathJax . error . inputID = script . MathJax . elementJax . inputID ;
2356
2357
//
2357
2358
// Create the [Math Processing Error] span
2358
2359
//
@@ -2361,28 +2362,23 @@ MathJax.Hub = {
2361
2362
var error = MathJax . HTML . Element ( "span" , {
2362
2363
className :"MathJax_Error" , jaxID :"Error" , isMathJax :true ,
2363
2364
id : script . MathJax . error . inputID + "-Frame"
2364
- } , errorText ) ;
2365
+ } , [ [ "span" , null , errorText ] ] ) ;
2365
2366
//
2366
2367
// Attach the menu events
2367
2368
//
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 ;
2370
2372
error . oncontextmenu = EVENT . Menu ;
2371
2373
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
+ } ) ;
2383
2377
//
2384
2378
// Insert the error into the page and remove any preview
2385
2379
//
2380
+ var node = document . getElementById ( error . id ) ;
2381
+ if ( node ) node . parentNode . removeChild ( node ) ;
2386
2382
script . parentNode . insertBefore ( error , script ) ;
2387
2383
if ( script . MathJax . preview ) { script . MathJax . preview . innerHTML = "" }
2388
2384
//
0 commit comments