- From: Danny Engelman <notifications@github.com>
- Date: Fri, 24 Feb 2023 06:06:58 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 24 February 2023 14:07:11 UTC
Reporting it here and not with the Chromium team, because it seems ``:host(:active)`` is the culprit
In this code
```javascript
<style>
#LIST div:last-of-type {
background:green;
}
</style>
<div id="LIST"></div>
<script>
LIST.attachShadow({mode: 'open'})
.innerHTML = `<style>:host(:active) button { background:red }</style><slot></slot><button>ADD</button>`;
LIST.onclick = () => LIST.appendChild(document.createElement('div')).innerHTML = `DIV`;
</script>
```
Chrome doesn't update the ``last-of-type`` CSS when clicking the ADD button

Behavior in FireFox is different (and correct I would say):

Better test code at: https://jsfiddle.net/WebComponents/Lkah15wy/
* It must be a combination of ``last-of-type`` AND shadowRoot AND ``:host(:active) button``, because: if I take out any of these (like replacing ``last-of-type`` with ``last-child``) everything is fine
* **adding** a CSS selector ``div:last-child{ color:gold }`` solves the issue
* replacing ``:host(:active) button`` with ``button:active`` solves the issue
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/985
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/985@github.com>
Received on Friday, 24 February 2023 14:07:11 UTC