Similar to this, but that answer actually transforms the template contents. e.g.
console.log(document.getElementById('t').innerHTML);
console.log(document.getElementById('t').content.textContent);
<template id="t">
<p>i <3 cheese</p>
</template>
This outputs
<p>i <3 cheese</p>
i <3 cheese
What I want back is:
<p>i <3 cheese</p>
i.e., exactly what's between <template>
and </template>
.
Is there a way to get that?
i <3 cheese
` is invalid HTML, so someone (probably your browser) is actually doing you a favor converting it into an entity. – Cobra_Fast Nov 08 '18 at 23:28