Modules and dependencies found during the load (before instantiation)
ian at hixie.ch
Mon Aug 18 10:55:34 PDT 2014
On Wed, 13 Aug 2014, Ian Hickson wrote:
> One of the problems I'm running into when it comes to trying to
> integrate ES6 modules with HTML and new HTML-based dependency features
> is the way that I can't tell ES about dependencies I know about before
> the data is actually fetched and instantiated.
Another example of where we have something like this is HTML imports. The
"fetch" hook for HTML imports needs to actually be the hook that does all
the parsing, since HTML loads incrementally. (For HTML imports, the
"translate" and "instantiate" hooks are essentially no-ops.) This means
that the in-band dependencies for HTML imports are found during the
"fetch" hook, and need to be set up right away. For example, if an HTML
import contains a <script type=module> block, that inline module needs to
be added as dependency of the import itself (so that the import's 'load'
event doesn't fire until all internal modules are loaded). It it contains
an <img src=""> element, that needs to be added as a dependency as its
loading. This is similar to the "instantiate" hook adding dependencies,
except that it has to happen earlier due to the incremental parsing.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the es-discuss