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

Check that parent is defined before getting its metrics. mathjax/MathJax#2191 #350

Merged
merged 4 commits into from
Oct 19, 2019

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Sep 22, 2019

If a typeset expression has been removed from the page, typesetting again can cause an error when the metrics are being determined. This PR checks that the location where the metrics are being taken has a parent element before trying to use it.

Resolves issue mathjax/MathJax#2191.

@dpvc dpvc requested a review from zorkow September 22, 2019 01:41
@dpvc
Copy link
Member Author

dpvc commented Sep 22, 2019

I added code to check that math item metrics are not being remeasured when they have already been measured, since it is not efficient to remeasure old math when new math is being processed.

@dpvc
Copy link
Member Author

dpvc commented Sep 22, 2019

I've also added code that prevents typeset math from attempting to be removed when the container is no longer in the document (e.g., the container had innerHTML set and the typeset math is now orphaned).

For example:

document.body.innerHTML = $$x$$';
MathJax.typeset();
document.body.innerHTML = $$y$$;
MathJax.typeset();
MathJax.startup.document.state(0, true);  // replace original math notation

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.

A missing space. O/w lgtm.

ts/output/common/OutputJax.ts Outdated Show resolved Hide resolved
@dpvc dpvc merged commit d7158c1 into develop Oct 19, 2019
@dpvc dpvc deleted the issue2191 branch October 19, 2019 11:29
@dpvc dpvc added this to the 3.0.1 milestone Mar 5, 2020
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