From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of James 
Burke


> In the spirit of the extensible web, defining these lower level APIs and more
> of the loader would make it possible to use custom elements to help
> prototype a <module> tag. The custom element mechanism can be used in a
> similar way to how JS transpilers are used for the existing module syntax.

No, custom elements cannot prototype the module tag, because custom elements 
will always be parsed as unknown elements. So e.g.

```html
<custom-module>
const stuff = "<p>Stuff</p>";
</custom-module>
```

will be parsed as

```
custom-module
|- text node: const stuff = "
|- p
|---- text node: Stuff
| - text node: ";
```

and of course it gets much worse if you use any elements that do something 
visual or interesting, like `<img>` or `<custom-module>` or `<script>`.

This is why we need to use an existing parsed-as-is element (namely `<script>`, 
although I guess we could maybe make `<style>` work in a pinch), and why custom 
elements won't work.

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to