The following outlines the spec changes to the HTML Standard that would be necessary to support the import.meta
proposal in a web browser host environment.
In the definitions section, add a new field to module scripts:
script element: A HTMLScriptElement
that initiated the graph, or null if it was not initiated by a script
element.
In the fetching scripts section, add an additional optional argument script element to the fetch a module script graph algorithm.
This then needs to be threaded through various algorithms, starting with fetch a module script graph and fetch the descendants of and instantiate a module script. Eventually it is passed to create a module script which sets the value in the newly-created module script's script element field.
The fetch a module worker script graph algorithm should, in contrast, pass through null as the script element to all the algorithms it calls.
In the prepare a script algorithm, pass through the script
element to the invocations of fetch a module script graph, create a module script, and fetch the descendants of and instantiate a module scirpt.
To the Integration with the JavaScript module system section, add this new subsection.
JavaScript contains an implementation-defined HostResolveImportedModule abstract operation. User agents must use the following implementation: [JAVASCRIPT]
- Let module script be moduleRecord.[[HostDefined]].
- Let url be module script's base URL, serialized.
- Let script element be module script's script element.
- Return « Record { [[Key]]: "
url
", [[Value]]: url }, Record { [[Key]]: "scriptElement
", [[Value]]: script element } ».