- From: James Browning <notifications@github.com>
- Date: Sun, 30 Jan 2022 18:31:46 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 31 January 2022 02:31:58 UTC
You could just do the following right? ([See here](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/shadowRoot)) ```js const shadowRoot = this.#internals.shadowRoot ?? this.attachShadow({ ...opts }); ``` Whether it is worth abstracting this into a new method I'm not sure. Although I would ask are empty shadow roots really so expensive that you can't just attach them unconditionally in the constructor? i.e.: ```js #internals = this.attachInternals(); constructor() { this.#attachShadow({ ...opts }); } connectedCallback() { this.#internals.shadowRoot.innerHTML = ``; } ``` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1046#issuecomment-1025323839 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1046/1025323839@github.com>
Received on Monday, 31 January 2022 02:31:58 UTC