[whatwg] Deferring image load

Boris Zbarsky bzbarsky at MIT.EDU
Mon Feb 13 06:59:09 PST 2012


On 2/13/12 9:29 AM, Bjartur Thorlacius wrote:
> On Mon, 13 Feb 2012 14:17:28 -0000, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>> This is a difficult optimization to make. You can only do it for
>> images that have a height and width specified in the markup, and worse
>> yet it leads to pretty bad flicker as the user scrolls (because
>> network roundtrip times are measured in hundreds of milliseconds to
>> seconds). So doing this by default is not likely to happen. Having a
>> page opt into it is a different story, though.
>>
> Well, UAs would fetch the images to be displayed first first, and then
> prefetch images until they have more than a screenful of undisplayed
> content loaded.

What does "screenful of undisplayed content" mean for some slide-deck 
site that just moves images in and out of view via script?

> But yes, fast scrolling would break this. Not even
> knowing the rough size of images before fetching them makes them hard to
> lay out until they have been downloaded.

Not knowing the size makes it _impossible_ to do layout correctly. 
Again, UAs would only be able to skip getting images that have explicit 
height and width attributes.

And even then, things could be troublesome if the pseudo-clases for 
detecting loading state are added, since those could affect layout...

-Boris



More information about the whatwg mailing list