shadycss
shadycss copied to clipboard
:host selector not selecting shadowed elements
I recently updated to Windows build 1709 that included an updated version of Edge:
Microsoft Edge 41.16299.15.0 Microsoft EdgeHTML 16.16299
With version 1.0.20 of web components, the :host shadow selector I am using is no longer working. It does work in Chrome (62.0.3203.94), it does not work in Firefox (57.0).
Here is a trivial example of what I am doing:
customElements.define('test-comp', class extends HTMLElement {
constructor() {
super();
var shadowRoot = this.attachShadow({mode: 'open'});
shadowRoot.innerHTML = `
<style>
:host { display: block; }
:host(.blue-text) .span-text { color: blue; }
.span-text { color: red; }
</style>
<span class="span-text">Test Web Component - I should be blue</span>`
}
})
so when the host element has a class of blue-text, the inner span get's a blue color. Here is an example plunk.
This SO post explained what is happening.