On Mon, 18 Aug 2014, John Barton wrote: > On Mon, Aug 18, 2014 at 10:43 AM, Ian Hickson <i...@hixie.ch> wrote: > > On Fri, 15 Aug 2014, John Barton wrote: > > > On Fri, Aug 15, 2014 at 3:41 PM, Ian Hickson <i...@hixie.ch> wrote: > > > > On Fri, 15 Aug 2014, John Barton wrote: > > > > > > > > > > The ES Loader does not maintain a dependency tree. It maintains > > > > > a table of names->modules. > > > > > > > > Maybe I'm misunderstanding the ES6 loader spec. What's the Load > > > > Record [[Dependencies]] list? > > > > > > The dependencies for the Load. Once the load is complete the record > > > is not needed. > > > > How about if the dependencies are changed during the load? For > > example: > > > > <script id=a src="a.js" load-policy=when-needed></script> > > This seems like an unfortunate design choice....
Can you elaborate? What would a better design be? I'm certainly not married to this approach. Fundamentally, though, if the problem is how to mark HTML elements as "load on demand" with a dependency tree, I don't see many options beyond putting things in HTML attributes or elements. (I use scripts in the example above, but the problem applies equally to images or other non-script features, and the use cases for them apply even with scripting disabled. For example, marking images as "load on demand" so that they don't load until the user scrolls down, with some images needing particular style sheets that are also to not load until you scroll down to the relevant image.) > > <script id=b src="b.js" load-policy=when-needed></script> > > <script id=c needs="a"> ... </script> > > <script> > > // at this point, the script with id=c is blocked waiting for a.js to > > // load. Let's change its dependencies: > > document.scripts.c.needs = 'b'; > > ...which leads to exotic quirks like this. Well, the DOM is mutable. If we hook something into the DOM, we have to define what happens when it mutates. > > // now the script needs to trigger b.js to load > > // a.js' load can be deprioritised (or canceled, if network is at a > > // premium), and no longer blocks the script from loading > > </script> > > System.import already supports dynamic loading with runtime dependency > selection. If you have a problem with it let's discuss that before > redesigning it. I'm not sure I follow. Can you elaborate? How would you use System.import() to mark e.g. an image as dependent on a style sheet when scripting is disabled? 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? -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.' _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss