W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2011

[whatwg] Proposal for separating script downloads and execution

From: Alexandre Morgaut <Alexandre.Morgaut@4d.com>
Date: Wed, 9 Feb 2011 12:03:50 +0100
Message-ID: <DA16519F-BD1F-4ABD-96E5-695AA03028C0@4d.com>

> i'm not sure you need an execute(), you might benefit from an event
> listener to tell you if a resource has been prefetched. but this
> general path seems less icky to me than most if not all of the other
> paths suggested in this thread.

you will surely take benefit from the onload event 

Actually this approach should already work in browsers supporting prefetch...

if the resource has already been fully loaded, the script calling for it will take profit from the cache
But what if it is only partially loaded ?
Is the User-Agent already smart enough to detect that there is already a request for this file and wait for it being fully loaded in the cache ?

Adding support of script mediatype or script relationship to the link tag:
- would make it possible for the browser to also pre-parse it.
- if execute() method is provided, it could take advantage of this pre-parsing while a eval on a string wouldn't

Another thing strongly missing in the support of the link tag is a content property to access to the content of the resource 
(which would be null if not loaded like for the XHR API)

This way, many resources loading could be more declarative instead of using XHR for anything
Received on Wednesday, 9 February 2011 03:03:50 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:30 UTC