Closed atirip closed 5 years ago
This is a limitation of the standard template tag, example:
var props = {foo: 'bar'};
var t = document.createElement('template');
t.innerHTML = `<html data-foo=${props.foo}>
<head>
<meta charset=utf-8>
<meta name=robots content=noindex>
</head>
<body>
</body>
</html>`;
t.content.children; // 2, just the meta
it's true you can do the via viperHTML, but it's also true it makes no sense to do that with client side templating, since you're looking for trouble if you replace any of those nodes (documentElement, body, head) so, since there are no use cases presented in here, I'll close this too as won't fix.
Use case is creating iframes, create html as a string and write it in.
On 5 May 2019, at 23:41, Andrea Giammarchi notifications@github.com wrote:
This is a limitation of the standard template tag, example:
var props = {foo: 'bar'}; var t = document.createElement('template'); t.innerHTML = `
<body> </body> </html>`;
t.content.children; // 2, just the meta it's true you can do the via viperHTML, but it's also true it makes no sense to do that with client side templating, since you're looking for trouble if you replace any of those nodes (documentElement, body, head) so, since there are no use cases presented in here, I'll close this too as won't fix.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
that's what document.write
is for.
I am not sure if anybody else needs this and it is not difficult to create them without hyperHTML :-), but:
https://codepen.io/anon/pen/VNoodW?editors=0011