I wanted to use the HTML 5 template tag but there's some confusing behaviour after a page refresh. Maybe I show you some code first:
<!doctype html>
<meta charset=utf-8>
<title>HTML 5 - template test</title>
<template>
<h1>This is an awesome new HTML 5 template</h1>
<p>.. some even more awesome content .. some even more awesome content .. some even more awesome content .. some even more awesome content .. some even more awesome content</p>
</template>
<div></div>
<script>
var template = document.querySelector('template'),
templateContent = template.content.cloneNode(true);
console.log(template);
console.log(templateContent);
document.querySelector('div').appendChild(templateContent);
</script>
Actually this works as expected, but there's some confusing stuff going on in the console. When I first open the page it says:
but when I refresh the page it shows up this:
When I repeat it I see the stuff from the first picture again. I tried it also on jsbin and there I can't see this behaviour: http://jsbin.com/ofotah/1
I have really no idea what is going on there. I'm using Google Chrome Version 27.0.1453.110 (Windows). Hope you can help me with this.