CSS space between outer ShadowDOM and inner ShadowDOM is separated.
<style>
.foo a.bar { text-decoration: none; color: skyblue; }
</style>
<div class="foo">
<a id="a1" class="bar">baz</a>
<custom-element>
(shadow)
<a id="a2" class="bar">baz</a>
(/shadow)
</custom-element>
<custom-element>
(shadow)
<a id="a3" class="bar">baz</a>
(/shadow)
</custom-element>
</div>
In above code, #a1
is applied style, but #a2
and #a3
are not.
So, I always append style element for each ShadowDOM.
The content of style elements is same.
I think that it is not good for performance when there are many elements. I want to set default style of a CustomElement by one element if possible.