[w3c/webcomponents] Update HTML Modules Proposed Spec changes and initial proposal document (#793)

I've made significant updates to the HTML Module proposed spec changes doc based on feedback [here](https://github.com/w3c/webcomponents/issues/783) and [here](https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ewfRSdqcOd8).

Highlights include:

• Rebased the ES changes on https://github.com/tc39/ecma262/pull/1311.  The most obvious change here is that HTML Module Record is now a subclass of Cyclic Module Record.
• HTML MR now inherits the concrete implementations of Instantiate() and Evaluate() from Cyclic MR (HTML MR still defines its own InnerModuleInstantiation /InnerModuleEvaluation.
• Updated ResolveExport to return a ResolvedBinding rather than the document itself.  HTML MR implementations of InitializeEnvironment() and ExecuteModule() were added to create a binding named “*default*” and set it to the document.
• Corrected GetExportedNames to refer to HTML MR instead of Source Text MR.
• HTML Module on the HTML5 side is now a type of Script called HTML Module Script, and the existing Module Script is renamed to JavaScript Module Script.
• ScriptEntry’s [[ScriptName]] field is renamed to [[ExternalScriptURL]] and [[ModuleRecord]] is renamed to [[InlineModuleRecord]].  The [[IsInline]] field was removed.
• Fixed ResolveExport so that it the HTML Module’s default export doesn’t override a default export specified by an inline script.
• Updated and refactored “create a module script” and ParseHTMLModule to ensure that all fields are initialized for HTML Module Script and HTML MR creation.
• Edited HTML Module proposal doc to state that non-module scripts in an HTML Module will cause a parse error and make the module to fail to create, rather than being silently coerced to `type="module`.

There are still some questions around whether the bulk of HTML Module Record and its algorithms should actually be defined in the HTML5 spec.  I expect this document to continue to evolve.

You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/webcomponents/pull/793


-- Commit Summary --

  * Rebasing ES spec changes on https://github.com/tc39/ecma262/pull/1311.  Misc other fixes/refactorings.
  * Update ParseHTMLModule to populate missing fields and update HTML MR InitializeEnvironment to create *default* binding for default export of document
  * Add plumbing for ES spec to get the HTML Module's default export (the document) and set it to the *document* binding during module Evaluation.  Plus some other minor corrections.
  * Update proposal to state that non-module scripts in HTML Module will cause error (rather than being silently coerced to type='module'
  * Minor wording/typo fixes.  Eliminate disclaimer at the top about some parts being handwavy -- we've mostly progressed beyond that, I think.

-- File Changes --

    M proposals/html-module-spec-changes.md (185)
    M proposals/html-modules-proposal.md (6)

-- Patch Links --

https://github.com/w3c/webcomponents/pull/793.patch

https://github.com/w3c/webcomponents/pull/793.diff


-- 
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/pull/793

Received on Wednesday, 13 February 2019 18:58:22 UTC