- From: Surma <notifications@github.com>
- Date: Sat, 03 Feb 2018 16:50:11 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 4 February 2018 00:51:05 UTC
Let’s say I have a custom element `<my-elem>`, that has the following shadow root markup:
```html
<style>
/* ... */
::slotted(main) {
background-color: blue;
}
::slotted(*) {
background-color: red;
}
</style>
<slot></slot>
```
```html
<my-elem>
<div>DIV!</div>
<main>MAIN!</main>
<aside>ASIDE!</aside>
</my-elem>
```
I’d argue most authors would expect `<main>` to have a blue background color, but it is in fact red. It seems the selectors passed to `::slotted()` don’t affect specificity. So precedence is defined by order of declaration.
Was this intentional? If so, why? If not, is it changeable?
([Live demo](https://slotted-specificity.glitch.me/), [code](https://glitch.com/edit/#!/slotted-specificity))
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/728
Received on Sunday, 4 February 2018 00:51:05 UTC