I have a Handlebars.js template with a HTML template to create Declarative Shadow DOM inside (required due to large content in actual case):
<script id="templatePreview" type="text/x-handlebars-template">
<ul>
{{#.}}
<li>
<template shadowroot="open">
{{name}}
</template>
</li>
{{/.}}
</ul>
</script>
For some strange reason, it does not render using jQuery (v3.5.x or latest 3.6.x) in latest Chrome (v91) or Firefox (v89):
<script>
const data = [{
name: "John"
},
{
name: "Peter"
},
{
name: "Mark"
},
];
$(function() {
let templatePreview = Handlebars.compile($('#templatePreview').html());
$("#main").append(templatePreview(data));
});
</script>
Here's a test JS bin: https://jsbin.com/bocenoqovi/edit?html,js,output
Chrome DevTools console shows the message below, but I'm not sure how to resolve this issue:
Found declarative shadowroot attribute on a template, but declarative Shadow DOM has not been enabled by includeShadowRoots.