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

Re: [whatwg] Load events fired during onload handlers

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 30 Jul 2012 11:44:14 -0400
Message-ID: <5016ABCE.10309@mit.edu>
To: whatwg@lists.whatwg.org
On 7/30/12 11:10 AM, James Graham wrote:
> 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).

In Gecko's case, the only thing like that I know of is that onload fires 
synchronously in Gecko in some cases, I believe. So we had to put in 
some sort of recursion guard to prevent firing onload on a parent in the 
middle of a child firing onload or something like that.  See 
<https://bugzilla.mozilla.org/show_bug.cgi?id=330089>.  Per spec, onload 
is always async, so this wouldn't be a concern.

I'm not quite sure what causes the behavior you're seeing in Gecko at 
<http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=1686>, but 
at first glance it's sort of accidental...  Which doesn't mean we 
shouldn't spec it, of course; it just means that figuring out what to 
spec is harder.  :(

If desired, I can try to figure out exactly why there's only one load 
event on the first iframe there.  Let me know.

-Boris
Received on Monday, 30 July 2012 15:44:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:09 GMT