Post

The DOM is a tree of nested elements. But shadow-DOM creates alternate universe trees. Consider details/summary: - in the light tree, details element contains a summary & anything else we put in there - in the shadow tree, it contains a summary & a (hidden to us) content block with a slot inside

0 reposts1 like

Our selectors work on one tree or the other. Light styles `details > p` will select a p we put into details. But `:host > p` from the shadow styles won't. The "flat tree" is light+shadow smushed back together. Props inherit from details into the shadow content block back out to our slotted p.

With a caveat that I didn't check my assumption of how details/summary elements are actually structured in browsers, and the actual shadow structure might be different between browsers – but it seemed like a simple example we could all imagine working that way. :)