The nesting is correct, but you're transforming to HTML into an XML document, serializing that as XML and then parsing it as HTML again using innerHTML. Along the way, you end up with an empty div element which is <div /> in XML but gets parsed as an open div tag in HTML. If you try loading the serialisation of the transformed document as HTML directly you'll end up with the wrong nesting too.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.