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

Reply via email to