Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-shadow-parts-1] Add an opt-in method for full shadow styling #2373

Open
jonrimmer opened this issue Mar 1, 2018 · 0 comments
Open

[css-shadow-parts-1] Add an opt-in method for full shadow styling #2373

jonrimmer opened this issue Mar 1, 2018 · 0 comments

Comments

@jonrimmer
Copy link

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.

@jonrimmer jonrimmer changed the title [css-shadow-parts-1] Add a opt-in method for full shadow styling [css-shadow-parts-1] Add an opt-in method for full shadow styling Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants