fix HTMLTemplateElement implementation to reflect standards behavior#63
Conversation
HTMLTemplateElement implementation to reflect standards behavior
|
So one thing I'm not super clear on is how instances of Specifically, as per this PR, when creating a template, it returns its contents inside <wcc-footer>
<template shadowroot="open">
<footer class="footer">
<h4>My Blog © 2022</h4>
</footer>
</template>
</wcc-footer>And when instantiating a Shadow Root in a custom element, we can set the class Footer extends HTMLElement {
connectedCallback() {
if (!this.shadowRoot) {
this.attachShadow({ mode: 'open' });
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
}
}So how does a template get access to the mode, which we would want so as to properly set the They are two different things with different class hierarchies from what I understand, so not sure what option to pursue here? I can think of a couple options at least just to get the ball rolling
I think either way, the main thing to accomplish with this PR is to get |
…eation for shadow roots
a0f25e6 to
9b1496a
Compare
Related Issue
resolves #51
Summary of Changes
<template>tag logic insideHTMLTemplateElement<template>implementation<template>implementationTODO
Make sure- support configurablethis.modeworks fromattachShadowshadowrootmodeattribute for<template>tags #65Questions
getInnerHTMLto make sure things are / will be still compatible -verify / ensure proper serialization of shadow roots excluding closed shadow roots fromgetInnerHTML#16get innerHTMLforHTMLTemplateElement? - tracked in `<template>` tags with variable interpolation for Declarative Shadow DOM #66<templates>but with variables / template literal placeholders. Or just create render functions?.... But then you lose the free<template>tag from usingdocument.createElement('template'). Maybe create some experimentalsetfunction fortemplate.innerHTML = '....'that can take args and destructure them? - `<template>` tags with variable interpolation for Declarative Shadow DOM #66