[WICG/webcomponents] FireFox ::part styles its own shadowRoot, which it should not? (Issue #982)

This code

https://jsfiddle.net/WebComponents/wajqfk3e/

```html
<style>
  ::part(main){
    color:green;
  }
</style>
<wc-part-test></wc-part-test>
<script>
  customElements.define('wc-part-test', class extends HTMLElement {
    constructor(){
      super()
        .attachShadow({mode:"open"})
        .innerHTML = `<style>::part(main){ background-color:red }</style>` + 
                     `<h1 part="main">Hello Web Component</h1>`;
  }});
</script>
```

Produces a colored background in FireFox 108.01:

![](https://i.imgur.com/6mUHiqG.png)

And none in Chrome 108.05:

![](https://i.imgur.com/Pc6Vv5M.png)

# "documentation"

* https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md  
Says: _"[::part] style inside a shadow tree, from **outside** of that shadow tree."_

* Some AI that often gives inclomplete answers says:  
_"To summarize, the ::part pseudo-element is used to style elements within a Shadow DOM shadow tree that have a part attribute. It **does not style the shadow root itself**._"

# Conclusion?

So I presume FireFox is wrong here?


..

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

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

Received on Sunday, 1 January 2023 15:12:01 UTC