google / incremental-dom

An in-place DOM diffing library
http://google.github.io/incremental-dom/
Apache License 2.0
3.54k stars 180 forks source link

Nested Patch Can Fail #377

Closed appzuka closed 6 years ago

appzuka commented 6 years ago

Code with a nested patch where the inner patch is on an element which is not contained within the outer patch will fail since commit 7c63e944. In patchFactory in core.ts, currentParent = node.parentNode; was moved to after getFocusedPath() so the inner patch uses the parent from the outer patch context. If that parent is not an ancestor of the inner patch element getFocusedPath will fail.

sparhami commented 6 years ago

Thanks for reporting the issue. This should be fixed and now has a test to cover it.