Re: [w3c/webcomponents] HTML Modules (#645)

@dandclark Overall I like the proposal a lot. Making every script type="module" is clever, because it makes everything simpler.

@AshleyScirra `import.meta.document` being limited to inline script is good design for at least 2 reasons:

First, js modules can be imported multiple times, from js or html and having `import.meta.document` would be inconsistent in such cases. Second, the js module can import its owner html module. That would be predictable because every type="module" js is async by default, so that circular import would work.

Another way to have `import.meta.document` in a web component architecture, would be to use dependency injection: Having one file importing both html and appropriate js module and initiating the js module with the html default import which is exactly `import.meta.document`.

If I understand correctly, the role of the inline script in a html module would be to expose more precise html elements, than just the document. Everything else can be done in normal js module imported by the main js module on the page.

-- 
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/645#issuecomment-427395178

Received on Friday, 5 October 2018 14:59:30 UTC