Re: [WICG/webcomponents] "open-stylable" Shadow Roots (#909)

One way that I’d like to articulate [my proposal](https://github.com/WICG/webcomponents/issues/909#issuecomment-1883480640) being different from what’s been suggested so far:

When plainly injecting document styles into a shadow root, the shadow root’s styles now are being compared by specificity with the document styles that are injected. If you are injecting the document styles before the shadow root’s styles, the shadow root has the benefit of order of appearance, however, it will lose on grounds of specificity, especially since styles in shadow roots generally are written with low specificity (since you’re in an encapsulated root).

By using layers, specificity becomes a non-issue for the shadow root’s own styles when compared with the document styles. The shadow root’s styles win since they are being cascaded after the layer the host has specified as the shadow root’s starting context. This also means that `::part()` is still usable as the component’s blessed styling API (think composed-component-specific or page-specific styles). And the component can itself still use `::slotted()` for styling slots.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/909#issuecomment-1885352180
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/909/1885352180@github.com>

Received on Wednesday, 10 January 2024 18:00:28 UTC