MathjaxV2: Can't render elements and get result synchronously
Issue Summary
With MathJax.Hub.Queue
, Seems that after 'Typeset' job done, the elements still will not be rendered fully, but outer
code block can get the result I want to get, even that this outer
block should not always act like this, consider it will be executed asynchronously.
Steps to Reproduce:
After script loaded, just execute the following code in browser console:
var mathbox = document.createElement('div');
mathbox.innerHTML='$$\sum_x^33$$'
MathJax.Hub.Queue(
['Typeset', MathJax.Hub, mathbox, () => {console.log('callback', mathbox.innerHTML);}],
["PreProcess",MathJax.Hub],
["Delay",MathJax.Callback,5000],
["Process",MathJax.Hub],
[() => {console.log('queue-next', mathbox.innerHTML);}]
);
console.log('outer', mathbox.innerHTML)
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead? I want to have “callback”, “queue-next”, 'outer' all get the same result, rather than get an incomplete rendered DOM object with “processing” styles. The documentation mentioned that typeset will call the callback function after its process completed, and for all jobs pushed into the Queue, should be executed synchronously, but I can't get the rendered result like outside code block can.
Technical details:
- MathJax Version: 2.7.9
- Client OS: Windows
- Browser: Firefox 102
I am using the following MathJax configuration: MathJax default
and loading MathJax via
<script src="https://unpkg.com/mathjax@2.7.9/MathJax.js?config=TeX-AMS_CHTML"></script>