[whatwg] Proposal for separating script downloads and execution

Kyle Simpson getify at gmail.com
Tue Feb 22 10:50:13 PST 2011

>>> 1)  If your script is no-cache, or max-age:0, does IE make a new
>>>     request for it for every<script>  element?
>> For the most part this seems to be the case but there are two exceptions:
>>    a) Before a URL loads, if it's assigned to another script, only one
>> request is made.
> OK, that would be a violation of the HTTP caching semantics.

Can you explain how, in more detail? In practice I haven't seen IE's 
behavior be a problem, but perhaps I'm not seeing the full context of the 
issue you're concerned with.

>> IE<  9 may mitigate this to some degree by enforcing its standard
>> garbage collection rules. If only circular references to the script
>> element exist, IE will abort the network request and never fire the
>> readystatechange event.
>> (function(){
>>     var s= create('script');
>>     s.src= ....
>>     s.onreadystatechange= function(){addToDom(this);};
>> })();
> Uh... In that situation I would expect the event handler to keep the 
> script alive until the load finishes.  Anything else is just a bug that 
> exposes GC timing to the web page.

I've said the same thing to Will before. I agree that a script having a 
circular reference to itself via the closure that's created when its handler 
is created and assigned... *should* have kept the item alive and not GC'd. I 
don't understand why IE GC's in this way.

In any case, for all intents and purposes, for someone to be using the 
"preloading" as we're suggesting (with either proposal), you'd have to keep 
around a reference to the script element anyway, so that you could later 
programmatically execute it. So, I think this GC quirk of IE would in 
practice mostly be avoided.



More information about the whatwg mailing list