Check for shadowRoot before creating it (SSR)
Closed this issue · 0 comments
acstll commented
A Custom Element being upgraded from HTML that includes a Declarative Shadow Root will already have that shadow root attached. This means the element will have a
shadowRoot
property already available when it is instantiated, without your code explicitly creating one. It's best to checkthis.shadowRoot
for any existing shadow root in your element's constructor. If there is already a value, the HTML for this component included a Declarative Shadow Root. If the value is null, there was no Declarative Shadow Root present in the HTML or the browser doesn't support Declarative Shadow DOM.