Closed valdrinkoshi closed 7 years ago
@alice I've realized the issue happens only if a node is hosted in a <template>
, because if we use a DocumentFragment to host nodes and then add the fragment to the main document, the parent of each node will be the new parent, not the DocumentFragment. This is not the case for <template>
:
var frag = document.createDocumentFragment();
frag.appendChild(document.createElement('div'));
document.body.appendChild(frag); // the <div>.parentNode is <body>
var templ = document.createElement('template');
templ.content.appendChild(document.createElement('div'));
document.body.appendChild(templ); // the <div>.parentNode is <template>.content!
I've updated the test and the implementation to handle specifically <template>
, PTAL 🍰
LGTM2
Fixes #337. @alice FYI