[whatwg/dom] Don't allow adopting DocumentFragment of a template element (#744)

Right now, we allow [adopting](https://dom.spec.whatwg.org/#concept-node-adopt) a [`DocumentFragment`](https://dom.spec.whatwg.org/#interface-documentfragment) of a [template element](https://html.spec.whatwg.org/multipage/scripting.html#the-template-element) because `DocumentFragment` never have a parent.

The subtree of such a `DocumentFragment` is still associated with the template element yet its owner document is of the adopted document. As far as I know, this is only case in which such an oddity arises because `ShadowRoot` is forbidden from being adopted into another tree, and every other node type would have a parent as long as it's part of a document and therefore will be removed before the adoption.

I don't think we should allow this. https://github.com/web-platform-tests/wpt/blob/master/html/semantics/scripting-1/the-template-element/template-element/template-content-hierarcy.html explicitly tests this.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/744

Received on Saturday, 30 March 2019 04:55:19 UTC