Skip to content

Conversation

@drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Feb 4, 2026

When a MathView element is initialized the mvInitialized data 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.

When a MathView element is initialized the `mvInitialized` data
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.
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.

1 participant