[whatwg] Script preloading
rniwa at apple.com
Thu Aug 29 16:34:34 PDT 2013
On Aug 29, 2013, at 8:37 AM, Nicholas Zakas <standards at nczconsulting.com> wrote:
> The question of dependency management is, in my mind, a separate issue and one that doesn't belong in this layer of the web platform. HTML isn't the right spot for a dependency tree to be defined for scripts (or anything else). To me, that is a problem to be solved within the ECMAScript world much the way CSS has @import available from within CSS code.
But why do you want an ability to say "don't execute this now" if there were no dependencies? Loading an extra script file that's not needed immediately can add few hundred of milliseconds to the total page load time over a slow network connection.
To put it another way, I don't see why anyone wants to load a script and not execute it other than for the purpose of avoiding the network request at a later time. However, if that were the main purpose of providing such a functionality, then we also need to address the issue of this load request needing to have a lower priority than other load requests that are vital for the page. In fact, we might want to avoid sending the request of a script file altogether if the user isn't going to interact the parts of the page that needs such a script.
- R. Niwa
More information about the whatwg