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

fix: can't record shadow root's children except the last one #956

Merged
merged 2 commits into from
Sep 7, 2022

Conversation

YunFeng0817
Copy link
Member

PR #834 added the ability to record incremental shadow dom mutations. But I found that it has a bug: If a shadow root has more than one child, the recorder can only record the last child and other children are ignored.

In the test case, I added one more child to the shadow root, but generated snapshot of the old version rrweb didn't change at all, which means the recorder did not record that child.

The reason is that all children except the last one of a shadow root are all added to the DoubleLinkedList in the pushAdd function because their siblings haven't been added yet. But while resolving these nodes in the next stage, their parentNode is the shadow root that is not in the Mirror so they are all ignored to break out the while loop. This PR adds a check for this situation.

@Juice10 Juice10 self-requested a review August 19, 2022 09:51
Copy link
Contributor

@Juice10 Juice10 left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants