Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle appending of inferred rows in MmlNode.appendChild() (mathjax/MathJax#2554) #601

Merged
merged 3 commits into from
Mar 12, 2021

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Feb 25, 2021

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 in setChildren() as well, since that uses appendChild() 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 make tslint 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.

@dpvc dpvc requested a review from zorkow February 25, 2021 19:47
@dpvc dpvc added this to the 3.1.3 milestone Feb 25, 2021
…plave by explicit mrow for nodes with fixed number of children).
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one minor thing.

@dpvc dpvc merged commit 2614f22 into develop Mar 12, 2021
@dpvc dpvc deleted the issue2554 branch March 12, 2021 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants