Hi,

Given that many important/natural use cases of custom elements involve shadow 
DOM,
can we add a flag to auto-create shadow DOM for custom elements?

In particular, can we add "template" as the third argument to document.register 
so that
when a custom element is "instantiated", the specified template is 
automatically closed
and inserted into a shadow DOM of the custom element.

e.g. using ES6 class syntax:

<template id=myButtonTemplate>
<button>Hi!</button>
</template>
<script>
class MyButton extends HTMLElement {
...
}
document.register('my-button', MyButton, myButtonTemplate);
</script>

Given that the shadow DOM specification is relatively stable if we constrain 
ourselves to
only custom elements (i.e. ignoring all builtin elements), adding this 
mechanism will allow
us to move the custom elements and shadow DOM specifications forward without 
risking
to expose the general API for attaching shadow DOM to the Web.

- R. Niwa

Reply via email to