Fix a possible infinite loop in the MathView initializion code. #1376
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.
When a MathView element is initialized the
mvInitializeddata attribute is set on the element, and if that attribute is found for the element in the mutation observer code, then the it does not try to reinitialize MathView for the element. However, the code only checks the primary node in the mutations list, and does not also check for this data attribute on any element contained therein. As a result, those elements can be initialized more than once.Now that the problem grader for webwork2 is in a collapse, the element for instructor comments is not initialy visible in the page and is revealed later by the problem grader javascript. This causes the MathView initializer to trigger repeatedly and crashes the page.
To test this set the "Assist with student entry process" to "MathView" for a course. Then open a problem when acting as a student. Make sure that a student has answered so that the comment box is available. With the develop branches for both webwork2 and pg, that will crash the page. With the develop branch of webwork2 and this pull request to pg that won't happen.