Web Components & Shadow DOM
What is the purpose of the adoptedStyleSheets property?
const sheet = new CSSStyleSheet();
sheet.replaceSync('.my-class { color: blue; }');
class MyElement extends HTMLElement {
constructor() {
super();
const shadow = this.attachShadow({ mode: 'open' });
shadow.adoptedStyleSheets = [sheet];
}
}