[whatwg] Script-related feedback
Steve Souders
whatwg at souders.org
Sat Jul 24 18:25:29 PDT 2010
"Defer" doesn't achieve the desired behavior. The goal is "load this
script after everything else in the page is done". Instead, defer'ed
scripts get loaded immediately, thus stealing one of the few network
connections from other (more important) resources.
Here's an example:
http://stevesouders.com/cuzillion/?c0=hj1hfft0_0_f&c1=bi1hfff2_0_f&c2=bi1hfff2_0_f&c3=bi1hfff2_0_f&c4=bi1hfff2_0_f&c5=bi1hfff2_0_f&c6=bi1hfff2_0_f&c7=bi1hfff2_0_f&c8=bi1hfff2_0_f
<http://stevesouders.com/cuzillion/?c0=hj1hfft0_0_f&c1=bi1hfff2_0_f&c2=bi1hfff2_0_f&c3=bi1hfff2_0_f&c4=bi1hfff2_0_f&c5=bi1hfff2_0_f&c6=bi1hfff2_0_f&c7=bi1hfff2_0_f&c8=bi1hfff2_0_f&t=1280020727443>
Notice that although the script is "defer" it gets loaded before the
images. (The load time of the script is displayed at the bottom and is
typically 200-500ms. However, each image takes 2000ms to download. If
the script was truly deferred it should be downloaded some time >
2000ms. Since it's loaded earlier, it steals a network connection and
causes one of the images to download later.)
-Steve
On 7/23/2010 1:27 PM, Ian Hickson wrote:
> On Wed, 17 Mar 2010, Steve Souders wrote:
>
>>> Given that it is possible to do this from script, how common is it for
>>> people to do it from script? If it's very common, that would be a good
>>> data point encouraging us to do this sooner rather than later.
>>>
>> 6 of the top 10 US web sites load scripts after the load event: eBay,
>> Facebook, Bing, MSN.com, MySpace, and Yahoo.
>>
> Do we know why they do this rather than use defer="", and whether
> defer="" would handle their use casess?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100724/8d27501f/attachment.htm>
More information about the whatwg
mailing list