- From: Ryosuke Niwa <notifications@github.com>
- Date: Thu, 26 Mar 2020 16:41:33 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 26 March 2020 23:41:46 UTC
It seems awkward that all SSR aware components would have to write code like this:
```js
class CustomHTMLElement extends HTMLElement {
#internals;
constructor() {
super();
#internals = this.attachInternals();
if (!#internals.shadowRoot)
this.attachShadow({mode: 'closed'});
}
}
```
With what I'm proposing (make attachShadow return the exiting declarative shadowRoot), we could something like this (obviously with a shorter name):
```js
class CustomHTMLElement extends HTMLElement {
#shadowRoot;
constructor() {
super();
#shadowRoot = this.attachShadow({mode: 'closed', returnExistingDeclarativeShadowRoot: true});
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/871#issuecomment-604741570
Received on Thursday, 26 March 2020 23:41:46 UTC