W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2012

[whatwg] Load events fired during onload handlers

From: James Graham <jgraham@opera.com>
Date: Mon, 30 Jul 2012 17:10:50 +0200
Message-ID: <5016A3FA.1030200@opera.com>
To: whatwg@whatwg.org
There seems to be general agreement (amongst browsers, not yet the spec) 
that if a document does something that causes a new load event from 
within an onload handler (document.open/document.close_ the second load 
event is not dispatched. This also applies to the load event on iframe 
elements if an event handler in the iframe would synchronously cause a 
second load event to fire.

There is not agreement about what happens where there are multiple 
frames e.g. if a load event handler on iframe element A would cause a 
load event in iframe B, should the handler on B fire. Gecko says yes, 
WebKit no. There is a slightly rubbish demo at [1].

I don't think I have a strong opinion about what should happen here, but 
the Gecko behaviour could be easier to implement, and the WebKit 
behaviour slightly safer (presumably the point of this anomaly is to 
prevent infinite loops in load event handers).

[1] http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1686
Received on Monday, 30 July 2012 15:11:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:44 UTC