-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call final MathJax.Hub.setRenderer directly (not with Queue)
This should remove a potential race condition
- Loading branch information
Showing
1 changed file
with
2 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,11 +178,6 @@ function texToSVG(_texString, _config, _callback) { | |
['setRenderer', MathJax.Hub, 'SVG'], | ||
['Typeset', MathJax.Hub, tmpDiv.node()], | ||
function() { | ||
// Restore original renderer if not SVG | ||
if(originalRenderer !== 'SVG') { | ||
MathJax.Hub.Queue(['setRenderer', MathJax.Hub, originalRenderer]); | ||
} | ||
|
||
var glyphDefs = d3.select('body').select('#MathJax_SVG_glyphs'); | ||
|
||
if(tmpDiv.select('.MathJax_SVG').empty() || !tmpDiv.select('svg').node()) { | ||
|
@@ -195,6 +190,8 @@ function texToSVG(_texString, _config, _callback) { | |
} | ||
|
||
tmpDiv.remove(); | ||
|
||
return MathJax.Hub.setRenderer(originalRenderer); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jonmmease
Author
Contributor
|
||
}); | ||
} | ||
|
||
|
This could still benefit from
if(originalRenderer !== 'SVG')
, right?Actually, it occurs to me then: perhaps the first two queue items could also be merged:
That way when we're living in a pure-SVG environment, the only overhead is (synchronously) querying the renderer, and the potentially-async
setRenderer
calls are all bypassed.