Open phillipskevin opened 5 years ago
I think viewRoot
is a bit more flexible than checking for a .shadowRoot
property. It's explicit and will work with closed shadow roots as well. If a shadow exists then there's probably no point of rendering a template into the light DOM. At least I've never heard of anyone doing that. Keeping viewRoot
gives you flexibility here. You could render a template into the shadow (manually) and have the framework render it into the element light DOM. Weird but possible.
the portal helper is semi-similar ... not sure if this means anything from an API perspective
You currently can render into
shadowDOM
by setting theviewRoot
property:https://github.com/canjs/can-stache-define-element/blob/75be0f9c937459f6eba13bcf21a09ec7999c26e4/src/mixin-stache-view-test.js#L44
This isn't currently documented because we might want to change how this works. It might be easier to just automatically render into shadowDOM if
attachShadow
was called and not have a specialviewRoot
property. Although maybe there will be use-cases for rendering somewhere else, soviewRoot
might be useful.