Clarify that declarative custom element definitions don't contain declarative shadow roots.
The current Declarative Custom Elements Strawman was authored before Declarative Custom Elements was specified, and the pattern of putting shadow root instance options on the `<template>` element. Now that that pattern does exist, it has created something of an semantic ambiguity with the strawman syntax. (with the assumption that `shadowmode` should be updated to `shadowrootmode`).
In this example, is `<template shadowmode="open">` intended to do?
```html
<definition name="my-element" constructor="MyElement">
<template shadowmode="open">~</template>
</definition>
```
Does it:
1. Create a shadow root on the `<definition>` element
2. Define a template with options to be used to initialize instance shadow roots.
If the answer is (2), then we have the same syntax with two different behaviors: one creates a shadow root instance, one defines future shadow roots.
Since the strawman was created before DSD, it doesn't seem like this collision was intended. I think to separate DSD from declarative custom elements, even just in this strawman syntax, we should make a small edit to put the options on a new element. This has the benefit of shortening the option names by not requiring the `shadowroot` prefix on every one.
```html
<definition name="my-element" constructor="MyElement">
<shadowoptions mode="open"></shadowoptions>
<template>~</template>
</definition>
```
cc @rniwa
合并状态:未合并 4 条评论