Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Mutation inside of a TreeWalker causes the walker to exit #8

Open
matthewp opened this issue May 2, 2018 · 1 comment
Open

Mutation inside of a TreeWalker causes the walker to exit #8

matthewp opened this issue May 2, 2018 · 1 comment

Comments

@matthewp
Copy link

matthewp commented May 2, 2018

This line:

parentNode!.replaceChild(partNode, node);

causes the demo to break. The <footer> part does not update with the values.

I think the issue is probably that we can't replaceChild inside of the walker loop. Maybe the solution is to defer dom mutations until after the loop is complete.

@matthewp
Copy link
Author

matthewp commented May 2, 2018

I was able to fix this by putting the mutation into a queue and running that queue after the while loop. Not sure if that is correct or not though. If acceptable I can send a PR over.

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

No branches or pull requests

1 participant