Re: [csswg-drafts] [css-shadow-parts] Can I use ::slotted and ::part together? (#5161)

Note that I was only experimenting, there are other ways of achieving my goal. E.g. my custom element could dynamically set a property on the child custom element and then I can just move the rules to the shadow styles of the slotted element.

What I ended up doing though is just export a global stylesheet with my library and moved the rules to there:

```html
<my-element>Here the part has a default style</my-element>
<my-container>
  <my-element>
    A shadow part is styled differently because we are a slotted child of
    <code>&lt;my-container&gt;</code>.
  <my-element>
</my-container>
```

```css
/* exported global stylesheet */
my-container my-element::part(my-shadow-part) {
  /* ... */
}
```

-- 
GitHub Notification of comment by runarberg
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5161#issuecomment-639616271 using your GitHub account

Received on Friday, 5 June 2020 16:35:31 UTC