On Mon, Aug 18, 2014 at 5:32 PM, Ian Hickson <[email protected]> wrote:
> On Mon, 18 Aug 2014, John Barton wrote:
>
...
> > 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.)
>
Supporting this case seems straight-forward and can be done entirely by the
browser Loader implementation using hooks.
The reverse case, where a img depends on a script, is not a use case.
>
> > > 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.
>
<script>
System.import('./former').then((former) => {
// do stuff with former, knowing './former' imported './latter'.
});
</script>
Here we are expressing the dependency of the HTML file on the non-loaded
file './former' and it depends on the non-loaded file './loaded'.
jjb
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss