Re: [WICG/webcomponents] [declarative-custom-elements] shorter syntax (#885)

I see what you mean. There's nothing wrong with it. I was only wondering if there's a less verbose way to do it.

What if with

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

the script runs once, but all other content of the `<element>` element is treated like template content for each instance?

If we could do that, then we could also extend the functionality to the following. In one file:

```html
<!-- my-el.html -->
<div>...</div>
<style>/*...*/</style>
<script type=module>
    export default class MyEl extends HTMLElement { /*...*/ }
</script>
```

In another file:

```html
<element name="my-el" shadowmode="closed" src="./my-el.html" />
```

which is very appealing.

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

Received on Monday, 22 March 2021 20:16:12 UTC