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

[whatwg] Proposal for separating script downloads and execution

From: Diego Perini <diego.perini@gmail.com>
Date: Wed, 9 Feb 2011 19:35:11 +0100
Message-ID: <AANLkTinnncEaNeaOQT=84ZrMoNW6AUgXZ1HofJyCOuMi@mail.gmail.com>
On Wed, Feb 9, 2011 at 6:57 PM, Alexandre Morgaut
<Alexandre.Morgaut at 4d.com> wrote:
>
> On Feb 9, 2011, at 4:40 PM, Nicholas Zakas wrote:
>
> I had chatted with a few folks about using rel=prefetch, but there seems to be a lot of issues that would have to be resolved to get the behavior I'm after. Prefetching in this way is very passive, currently implemented as happening during user idle time, which is unpredictable (not to mention the issues Glen mentioned below).
>
> I think you guys are perfectly right as "prefetch" is not meant to say that the interface will need the resource ASAP
>
>
> I think Glen summed this up correct by saying that prefetching is a hint, and when you want to load a script you want it to happen. This isn't to say that you wouldn't want to prefetch a script, but I see that as more of a way to help the next page you'll navigate to by priming the cache vs. helping the currently loaded page.
>
> Good point
>
> In any event, it seems that rel=prefetch would have to change a lot vs. the changes to the script element to allow the same behavior.
>
> Surely, if starting from the specific "prefetch" behavior
>
>
> I still think that using a more declarative way to define required HTTP resources would be a gain and may work in your case
>
> The link type list is rich:
> - http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#linkTypes
>
> Adding a "required" relationShip could be more appropriate way
>
> <link id="someScript" rel="required" type="text/javascript" src="someData.js">
> <link id="someData" rel="required" type="application/json" src="someData.json">
> <link id="aTemplate" rel="required" type="text/html" src="myTemplate.html">
>
> This would still need:
> - a "content" property on HTML link elements (which may be also useful to access raw CSS definition)
>
> Binding an execute(), run() or eval() method on link elements may be more discussable but it doesn't hurt me that much
> This way, pre-parsing Script resources would be still possible
>

Completely agree, your proposal seems better, probably easier to
implement and seem less prone to backward compatibility issues to me.

I believe it would be better to leave out the script tag and try to
obtain the same benefits by defining the correct "rel" on link
elements.

Having script access to the content of the HTTP resource is what is
really missing and seems to me would cover most of the presented
needs.

Maybe not completely related to script loading, but bubbling all
"load" events up to the document like Opera does would also help
authors in determining the correct timings (when to execute/use the
resource once it is fully loaded).

--
Diego
Received on Wednesday, 9 February 2011 10:35:11 UTC

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