mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-14 07:02:54 +00:00
If a style element belongs to a shadow tree, its CSSStyleSheet is now added to the corresponding ShadowRoot instead of the document. Co-authored-by: Simon Wanner <simon+git@skyrising.xyz>
18 lines
662 B
HTML
18 lines
662 B
HTML
<script src="include.js"></script>
|
|
<my-custom-element></my-custom-element>
|
|
<script>
|
|
test(() => {
|
|
class MyCustomElement extends HTMLElement {
|
|
constructor() {
|
|
super();
|
|
const shadow = this.attachShadow({ mode: 'open' });
|
|
const style = document.createElement('style');
|
|
shadow.appendChild(style);
|
|
println(`shadow.styleSheets.length=${shadow.styleSheets.length}`);
|
|
println(`document.styleSheets.length=${document.styleSheets.length}`);
|
|
}
|
|
}
|
|
|
|
customElements.define('my-custom-element', MyCustomElement);
|
|
});
|
|
</script>
|