class MyCustomElement extends HTMLElement {
constructor() {
super();
this.internals_ = this.attachInternals();
console.log(this.internals_.shadowRoot); // null
this.attachShadow({ mode: "open" });
console.log(this.internals_.shadowRoot); // a ShadowRoot object
}
}ElementInternals: shadowRoot property / notebook
ElementInternals: shadowRoot property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.