[whatwg/dom] feature: `element.getShadow(opts)` (Issue #1046)

This would be an alternative to `element.attachShadow(opts)`. It would be more like `getContext` in that if a root is not already created and attached, it will create and attached it before returning it. If it is already created, the existing root will be returned. This would make it easier to write code like this:

```js
class MyEl extends HTMLElement {
  connectedCallback() {
    this.getShadow(opts).innerHTML = `...`
  }
}
```

without having to write extra code to handle whether or not a root already exists.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1046
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1046@github.com>

Received on Friday, 14 January 2022 21:18:25 UTC