Steps to reproduce
<iframe id=x></iframe> <script> x.contentDocument.body.appendChild(x); </script>
In Edge this throws HierarchyRequestError. This violates the DOM spec. Other browsers don’t throw.
Nothing prevents the iframe element from being moved to its own document (about:blank is same-origin). So the iframe element is removed from its original document.
When an iframe is removed from a document, its browsing context disappears. So the child document does not have a browsing context when the iframe element is inserted into it. Therefore the iframe, after the move, does not have a new child browsing context (there’s no infinite recursion happening).
When an iframe element is inserted into a document that has a browsing context, the user agent must create a new browsing context, set the element’s nested browsing context to the newly-created browsing context, and then process the iframe attributes for the "first time".
When an iframe element is removed from a document, the user agent must discard the element’s nested browsing context, if it is not null, and then set the element’s nested browsing context to null.
Comments and activity
- Microsoft Edge Team
Changed Assigned To to “Brad E.”
Changed Assigned To to “Travis L.”
Changed Assigned To from “Travis L.” to “Bo C.”
Changed Status to “Confirmed”