[csswg-drafts] [css-shadow-parts-1] Add a opt-in method for full shadow styling

jonrimmer has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-shadow-parts-1] Add a opt-in method for full shadow styling ==
>From what I've seen, the discussions around shadow DOM styling have focussed on the scenario of using encapsulation to protect components from unwanted interference by 3rd-party, unrelated code. E.g. a commercial component library that wants to prevent customers from relying on implementation details that may later change.

However, I think this ignores a more common use-case in applications built using component-based frameworks like Polymer and Angular. Here, shadow DOM is used more as a namespacing mechanism to guard against *accidental* style inference between peers. E.g. if I write a `HomepageComponent` and a `TabsPanelComponent`, it lets me easily write styles that target only the views of those components. But, practically speaking, since these components are under the full control of me/my team, I can trust them to style anything about each other, if they need to.

To do this with the current parts proposal, I would have to add some wrapper element (if one did not already exist) to each component's view, with a part attribute like `part="all"`. Is there value in adding a simpler mechanism for this? What I'm thinking is that, when you create a shadow root, there could be an option to opt-in to exposing the whole shadow root DOM under a pseudo called `::shadow`, or some such.

This isn't technically adding anything new in terms of capability, but I think it would make this common scenario easier, and eliminate the need to create wrapper elements just for the purpose of exposing the whole shadow DOM as a part.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2373 using your GitHub account

Received on Thursday, 1 March 2018 11:20:25 UTC