You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So how does a template get access to the mode, which we would want so as to properly set the shadowroot attribute? Presumably some users may want the option of open / closed, and this may also impact how we implement #16. Also, these two are the same things, right?
Details
My understanding is shadowRoot and HTMLTemplateElement are different class hierarchies (sub classes) 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
Have the compiler check for mode when serializing and update it that way
asyncfunctionrenderComponentRoots(tree){for(constnodeoftree.childNodes){if(node.tagName&&node.tagName.indexOf('-')>0){
...
constelementHtml=elementInstance.shadowRoot
? elementInstance.getInnerHTML({includeShadowRoots: true})
: elementInstance.innerHTML;constelementTree=parseFragment(elementHtml);// if we have a shadowRoot, set the `<template>` shadowroot attribute according to shadowRoot.modeif(elementInstance.shadowRoot){constmode=elementInstance.shadowRoot.mode;// do something with the tree and set the attribute on the `<template>` accordingly}
...
}
...
}returntree;}
I'm thinking option #2 seems pretty feasible. Also, not sure if this means we need a get innerHTML for HTMLTemplateElement too?
The text was updated successfully, but these errors were encountered:
thescientist13
changed the title
support configurable shadow-root attribute on <template> tags
support configurable shadowroot attribute for <template> tags
Jun 12, 2022
Type of Change
Summary
Coming out of #63 (comment), just wanted to track the discussion around how to actually support the
shadowroot
attribute for<template>
tags as I'm not super clear on is how instances of<template>
tags (HTMLTemplateElement
) andShadowRoot
work together, specifically around theshadowroot="open"
attribute andmode
.Specifically, as per that PR, when creating a template, a template returns its contents inside
<template>
tags, eg.And when instantiating a Shadow Root in a custom element, we can set the
mode
that way, e.g.So how does a template get access to the mode, which we would want so as to properly set the
shadowroot
attribute? Presumably some users may want the option of open / closed, and this may also impact how we implement #16. Also, these two are the same things, right?Details
My understanding is
shadowRoot
andHTMLTemplateElement
are different class hierarchies (sub classes) 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<template>
mode
when serializing and update it that wayI'm thinking option #2 seems pretty feasible. Also, not sure if this means we need a
get innerHTML
forHTMLTemplateElement
too?The text was updated successfully, but these errors were encountered: