Handle appending of inferred rows in MmlNode.appendChild() (mathjax/MathJax#2554) #601
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.
Inferred mrows are used to hold multiple MathML nodes in situations where a single node is expected (e.g., they act as MathML fragments). For example, the TexParser's
ParseArg()
function can return an inferred mrow. These should not appear as children of normal MathML elements, and so historically the code had to be careful to check the return value of such functions in order to handle inferred mrows as a special case. While this was done in many places, some situations still slipped through. An unexpected inferred mrow did not affect CHTML output, but it does cause problems for SVG output, with mathjax/MathJax#2554, mathjax/MathJax#2624, and mathjax/MathJax#2577 being examples.Rather than try to patch each new occurrence as it appears, this PR resolves it at the lowest lever: the MmlNode's
appendChild()
function. In the event that an inferred mrow is appended to an element, the mrow's children are appended instead. This catches the problem insetChildren()
as well, since that usesappendChild()
internally.This PR removes some of the special-casing that was done in NodeFactory and ParseUtil, since appending the children now handles the inferred mrows directly. (There is one difference, which is that NodeFactory would turn the inferred mrows into actual mrows, but that should not be necessary. It will mean some tests will probably have to be updated, though.)
This PR also moves the
texclass
property to below the static properties to maketslint
happy.Resolves issues mathjax/MathJax#2554 and mathjax/MathJax#2624.
Note that this means that PR #585 is no longer needed, as this PR is a better solution.