@@ -85,7 +85,7 @@ var timer; // used to reset MathJax if it runs too lon
8585var document , window , content , html ; // the DOM elements
8686
8787var queue = [ ] ; // queue of typesetting requests of the form [data,callback]
88- var data , callback ; // the current queue item
88+ var data , callback , originalData ; // the current queue item
8989var errors = [ ] ; // errors collected durring the typesetting
9090var ID = 0 ; // id for this SVG element
9191
@@ -648,7 +648,7 @@ function GetSVG(result) {
648648// Start typesetting the queued expressions
649649//
650650function StartQueue ( ) {
651- data = callback = null ; // clear existing equation, if any
651+ data = callback = originalData = null ; // clear existing equation, if any
652652 errors = [ ] ; // clear any errors
653653 if ( ! queue . length ) return ; // return if nothing to do
654654
@@ -660,7 +660,7 @@ function StartQueue() {
660660 // and set the content with the proper script type
661661 //
662662 var item = queue . shift ( ) ;
663- data = item [ 0 ] ; callback = item [ 1 ] ;
663+ data = item [ 0 ] ; callback = item [ 1 ] ; originalData = item [ 2 ] ;
664664 content . innerHTML = "" ;
665665 MathJax . HTML . addElement ( content , "script" , { type : "math/" + TYPES [ data . format ] } , [ data . math ] ) ;
666666 html . setAttribute ( "xmlns:" + data . xmlns , "http://www.w3.org/1998/Math/MathML" ) ;
@@ -775,7 +775,7 @@ function ReturnResult(result) {
775775 state . ID = ID ;
776776 }
777777 serverState = STATE . READY ;
778- callback ( result , data ) ;
778+ callback ( result , originalData ) ;
779779 if ( serverState === STATE . READY ) StartQueue ( ) ;
780780}
781781
@@ -836,7 +836,7 @@ exports.typeset = function (data,callback) {
836836 } }
837837 if ( data . state ) { options . state = data . state }
838838 if ( ! TYPES [ options . format ] ) { ReportError ( "Unknown format: " + options . format , callback ) ; return }
839- queue . push ( [ options , callback ] ) ;
839+ queue . push ( [ options , callback , Object . assign ( { } , data ) ] ) ;
840840 if ( serverState == STATE . STOPPED ) { RestartMathJax ( ) }
841841 if ( serverState == STATE . READY ) StartQueue ( ) ;
842842}
0 commit comments