zoid
zoid copied to clipboard
Bug: Zoid erroneously says container element removed from DOM when modifying HTML body
Here's a bug I found.
- Import Zoid
- Modify
document.body
, egdocument.body.innerHTML += 'test'
- Render a Zoid component into a container element (not the default of
document.body
) - Component does not render, gives error
Uncaught Error: Detected container element removed from DOM
So, modifying the document body makes Zoid fail to render, even though it is modified before the call to render
and even though we are rendering into an element rather than the body.
Zoid part of the stack trace:
Uncaught Error: Detected container element removed from DOM
at zoid.js:3699
at zoid.js:1072
at elementClosed (zoid.js:3663)
at zoid.js:3668
at zoid.js:3698
at ZalgoPromise._proto.dispatch (zoid.js:245)
at ZalgoPromise._proto.then (zoid.js:282)
at renderContainer (zoid.js:3634)
at zoid.js:4068
at ZalgoPromise._proto.dispatch (zoid.js:245)
Tested in Chrome for Mac Version 92.0.4515.131 (Official Build) (x86_64)
.
Tested with Zoid 9.0.73
and 9.0.31
.
I had the same problem, and I put a setTimeout
before making the DOM changes