Changing dependencies during the load process.

Ian Hickson ian at
Mon Aug 18 17:32:15 PDT 2014

On Mon, 18 Aug 2014, John Barton wrote:
> Your examples use script. I just don't think now that we should use the 
> same solution for HTML. We should analyze the HTML requirements and design
> a solution. If the result is similar to script then we can reuse.

That's what I've been doing. My conclusion is that it's very similar, and 
just requires a few changes to the ES6 module loader design, those I've 
been describing.

The alternative is that we end up with two very similar dependency systems 
which interact (because people want to have scripts depend on HTML 
features and vice versa). This does not seem like a win to me.

> But in the case of image tags we already know exactly which image the 
> HTML depends upon.

But other elements might depends on the <img>, and that we don't know.

(For example, a graphical game might need some sprite assets to be loaded 
before it can start up. So its <script> might be marked as depending on an 
<img> element that loads that image. Or the script contents might have an 
import statement that refers to that image.)

> > Or indeed even when scripting is enabled, how would you use it to mark 
> > one non-loaded script as dependent on another non-loaded script such 
> > that when you later ask for the former, the latter loads 
> > automatically?
> import './latter';
> It's a solved problem for scripts.

The key part of my question was "non-loaded". The "import" bit is in the 
script. The script isn't loaded yet, so we can't rely on it.

> Discussing HTML dependency loading and ES dependency loading together 
> makes a lot of sense -- up to a point. But requiring specs and 
> implementations to converge does not seem good to me now.

It seems really good to me, given the alternative. But I'll defer to the 
rest of the JS spec community to make that decision, since it requires 
changes to the ES6 spec if we're going to do it.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the es-discuss mailing list