Re: [WICG/webcomponents] [declarative-custom-elements] Capabilities needed and open questions (Issue #1009)

Maybe.

When I look at some of the proposals for what [declarative custom elements](https://github.com/WICG/webcomponents/issues/885) might look like:

```html
<definition name="percentage-bar">
    <template shadowmode="closed">
        <div>...</div>
        <style>/*...*/</style>
    </template>
    <script type=module>
        export default class MyEl extends HTMLElement { /*...*/ }
    </script>
</definition>
```

... it's unclear to me whether that definition is intended to serve dual roles, or a single role.  Dual roles would be not only does it define the structure of the custom element, but it would also be rendered directly in the live DOM tree as one instance of the custom element.

A single role would mean that the SSR generated content would automatically become ShadowDOM(ed) (already possible today in Chrome and Safari), but without that separate definition tag added somewhere, it would remain static HTML, and not morph into a web component.

I make that distinction clear (in my mind) [here](https://github.com/bahrus/be-definitive).  Examples 1,2, 4, 5, the defining element serves dual roles.  Example 3, that uses a template to define the element, doesn't.  Example 3 has fewer parts to resolve, as there's no issue with how to construct the template for repeated renderings, for starters.

It's not clear to me whether I'm the only one who thinks serving dual roles is something worth pursuing, or if everyone is assuming that that goes without saying?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1009#issuecomment-1525932339
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1009/1525932339@github.com>

Received on Thursday, 27 April 2023 15:47:31 UTC