[whatwg] Link.onload; defer on style, depends

Ian Hickson ian at hixie.ch
Tue Apr 28 00:32:44 PDT 2009

On Tue, 28 Apr 2009, Boris Zbarsky wrote:
> The testcase I was thinking of is:
>   <body onload="3">
>     <img onload="1; image = new Image(); image.src = 'test'; image.onload = 2"
> src="foo">
>     <img src="bar">
> In Gecko, on this testcase, the handlers always run in the order 1, 2, 3.

Ah, yes. good point. I can require that relatively simply (just have the 
tasks that are queued for 'load' events themselves delay the page's load 
event), should I? It seems like you can still get into weird conditions, 
like what if you have this situation:

   <body onload="">
     <img src=a onload="setTimeout(f, 100)">
     <img src=b>

If f() creates a new Image object, the order in which the events fire will 
depend on whether the timeout fires before or after b's onload fires.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list