Fix problem with enabling explorer with MathML input. mathjax/MathJax#2255 #425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue with turning on/off the explorer when the input is MathML. This was caused by several issues. First, the
reset()
call in therenderActions
list was causing thererender()
action initiated by the menu when explorer is toggled to try to reprocess the entire page (leading to duplicate entries in the math list). So thereset()
has been moved to theMathJax.typeset()
andMathJax.typesetPromise()
calls. Users callingrender()
by hand will need to callreset()
prior to that. (Since none of that is documented yet, it should not be an issue.) Also the menu code that creates a new document saves the processed bits as well (since they aren't being reset).The other problem was that when the typeset content is removed in
removeFromDocument()
, it was being replaced by a blank text element, and thestart.node
pointer was set to that empty text element. But when MathML is compiled, thestart.node
pointer is supposed to be the MathML node itself. So this PR adds a check to see ifstart.node
is a text node, and recompiled from the original MathML text instead.Resolves issue mathjax/MathJax#2255.