[whatwg] comments on SCRIPT ASYNC and DEFER

Henri Sivonen hsivonen at iki.fi
Wed Feb 10 01:31:16 PST 2010

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.

Henri Sivonen
hsivonen at iki.fi

More information about the whatwg mailing list