Unmarshalling around a cloned DOM doesn't explicitly attach root element
Basics
Technical
Logistics
Basics
Technical
Logistics
Description
Cloning an object with a DOM is optimized by cloning the DOM into a new document and unmarshalling around that DOM, with bindDocument set. But that alone doesn't attach the root of the DOM as the document root element, and a no-op marshall() of the clone won't fix it.
The best fix seems to be to handle it anytime a DOM element is set into an object with bindDocument set, and just ensure that element is set as the root.
Cloning an object with a DOM is optimized by cloning the DOM into a new document and unmarshalling around that DOM, with bindDocument set. But that alone doesn't attach the root of the DOM as the document root element, and a no-op marshall() of the clone won't fix it.
The best fix seems to be to handle it anytime a DOM element is set into an object with bindDocument set, and just ensure that element is set as the root.