HTMLTemplateElement should create a signleton owner document that's shared amongst all of its "inert" contents. See https://html.spec.whatwg.org/multipage/scripting.html#appropriate-template-contents-owner-document This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/scripting-1/the-template-element/template-element/node-document-changes.html
<rdar://problem/22587512>
html/semantics/scripting-1/the-template-element/definitions/template-contents-owner-test-001.html also fails because of this bug.
Oh oops, I uploaded the patch to a wrong bug :( *** This bug has been marked as a duplicate of bug 154936 ***