- From: Mike Samuel <notifications@github.com>
- Date: Wed, 01 May 2019 09:06:02 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 1 May 2019 16:06:24 UTC
This works for me with `python -m SimpleHTTPServer`
## main.js.html
```js
<!-- --><meta charset="utf8"><script type="module">
import bar from './bar.js';
export default null;
setTimeout(
() => document.body.appendChild(document.createTextNode(bar)),
0);
// </script>
```
## bar.js
```js
//<!-- --><meta charset="utf8"><script type="module">
export default 'Hello, World!';
// </script>
```
Without the // at the beginning in `foo.js`, I get
> Uncaught SyntaxError: HTML comments are not allowed in modules
because of https://tc39.github.io/ecma262/#sec-html-like-comments
> ## B.1.3 HTML-like Comments
> The syntax and semantics of 11.4 is extended as follows **except that this extension is not allowed when parsing source code using the goal symbol *Module*:**
so if you want to serve a JavaScript file that operates as an entire HTML document, and the polyglot approach is ok for you, then maybe ask github.com/tc39 to remove that exception.
----
> Currently, you can use client-side javascript to modify an "already existing" html document. ... What you **can't** do, is ...
What does having client-side javascript set the current document enable?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/807#issuecomment-488326500
Received on Wednesday, 1 May 2019 16:06:24 UTC