[whatwg] comments on SCRIPT ASYNC and DEFER

Steve Souders whatwg at souders.org
Wed Feb 10 10:49:24 PST 2010


Two common scenarios where scripts aren't put at the bottom:
     - Having talked to web devs across hundreds of companies it's often 
the case that they control a certain section of the page. Inserting 
content outside of that section requires changing so much 
infrastructure, they skip the optimization.
     - 3rd parties have no control over where their snippet is placed in 
the content owner's page. Providing a snippet that contains "DEFER" will 
guarantee they don't block the main page's content.

-Steve

On 2/10/2010 1:31 AM, Henri Sivonen wrote:
> On Feb 8, 2010, at 23:54, Steve Souders wrote:
>
>    
>> It would be good to mention this optional behavior here, something along the lines of browsers may want to do speculative parsing, but shouldn't create DOM elements, etc. - only kickoff HTTP requests.
>>      
> FWIW, the HTML5 parser in Gecko (not on by default yet) does more than just kicks off HTTP requests. However, what it does isn't supposed to be detectable by author-supplied scripts.
>
>    
>> 4. "If the element has a src attribute, [snip] the specified resource must then be fetched, from the origin of the element's Document."
>>      If the script has DEFER, the request should not start until after parsing is finished. Starting it earlier could block other (non-deferred) requests due to a connection limit or limited bandwidth.
>>      
> As I understand it, starting the request early is the whole point of 'defer'. Otherwise, the author could put those scripts at the end of the page.
>
>    


More information about the whatwg mailing list