3 ms·
> Shadowroots are great when you need encapsulation of styles or static non-content UI, but with this outer element neither of those are true. There isn't any a
by WorldMaker 6y ago
> Shadowroots are great when you need encapsulation of styles or static non-content UI, but with this outer element neither of those are true. There isn't any additional UI, nor styles.
To my understanding of these components, because they are meant to be styled by the user or a downstream design system the component authors don't know ahead of time where style encapsulation needs to happen, so this approach makes sense for that.
- jjcm 6y agoFor sure, and that's a pretty cool feature of this library. Nonetheless they should be checking whether or not there are included templates/designs before generating the shadowroot. I put together a small demo of this in action: https://github.com/jjcm/shadowTests/blob/master/withOptionalShadow.html https://github.com/jjcm/shadowTests/blob/master/withOptional... The results speak for themselves: https://raw.githubusercontent.com/jjcm/shadowTests/master/resultsForOptionalCreation.png https://raw.githubusercontent.com/jjcm/shadowTests/master/re... Creating a shadowroot conditionally has nearly equivalent performance to no shadowroot at all, but always creating a shadowroot is about twice as slow.