[whatwg] Deferring image load

Boris Zbarsky bzbarsky at MIT.EDU
Mon Feb 13 11:12:09 PST 2012


On 2/13/12 1:52 PM, Bjartur Thorlacius wrote:
>> 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.
>>
> On the contrary, if you've laid out two screenfuls you can guess that
> anything after that will not be in the aforeoutlaid* screenfuls.

I wasn't talking about guessing at visibility.  I was talking stuff like 
this:

   <!doctype html>
   <div style="height: 100vh"></div>
   <img src="something">
   <div style="position: relative; top: -50vh"></div>

Where should that second div be placed?  Should the user be able to see 
it?  You don't know until you know the image size.

And it gets even worse when tables are involved, because an image 
arbitrarily far down the table can affect the table column widths and 
the width of the whole table and the site probably depends on particular 
widths.

Similar for various other layouts that involve shrink-wrapping (floats 
and abs pos containers are the chief reasons for that).

>> And even then, things could be troublesome if the pseudo-clases for
>> detecting loading state are added, since those could affect layout...
>>
> As I say, there are numerous compatibility problems.

Indeed.

> If image dimensions late in the document affect the layout of a previous part of the
> document, as you seem to hint at, then hell is loose if we don't know
> them. Guessing would be most unfortunate and surprising to layout
> designers.

Yep.  :(

-Boris



More information about the whatwg mailing list