The first log returns a full li
element while the second one returns an empty DocumentFragment
. Why? I couldn't find any information about that behavior in any documentation.
var main = document.getElementById('main');
var fooTemplate = document.getElementById('my-template');
var foo = fooTemplate.content.cloneNode(true);
console.log(foo);
main.appendChild(foo);
console.log(foo);
<template id="my-template">
<li>foo</li>
</template>
<ul id="main">
</ul>