W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2006

Re: capturing load events II

From: Master Br <master@sitesbr.net>
Date: Thu, 28 Dec 2006 11:23:00 -0300
Message-ID: <4593D344.1050401@sitesbr.net>
To: Joćo Eiras <joao.eiras@gmail.com>
CC: "Hallvord R. M. Steen" <hallvord@opera.com>, "www-dom@w3.org" <www-dom@w3.org>

I have just changed the test file to support the poor Internet Explorer ...

http://dosergio.kit.net/test_LOAD_events.htm

And here comes the surprise:

Even Internet Explorer - that is a bad browser concerning to W3C 
standards - works better than Opera concerning to this point.
Internet Explorer only invokes the load function added on window ONCE, 
what is the CORRECT behavior.
And Internet Explorer alerts when the images are loaded before saying 
that the body was loaded.

Only Opera does the weird mistake of firing the window load object for 
every load event occurred on any document childNodes..."

window.addEventListener must caught only events on DOCUMENT, not from 
its children.

That's why I only use Firefox.


Joćo Eiras escreveu:
>
>
> I too have 3 questions:
>
>   - is the window considered as a target in the entire event capturing 
> and bubbling phases ?
>     * in Gecko yes, in Opera no.
>
>   - should events registered to the window have the document as target ?
>     * both in Gecko and Opera yes.
>
>   - should capturing of load events be supported too when registering 
> a capturing event listener in the window ?
>     * in Opera yes, in Gecko no as consequence of their 'fix'
>
> The ecmascript binding needs clarification in this regard.
>
>
> Hallvord R. M. Steen <hallvord@opera.com> escreveu:
>
>> Hi,
>> I have a request for clarification regarding the behaviour of 
>> capturing events.
>>
>> Opera has implemented capture of load events in the document, meaning 
>> that an event listener added with
>>
>> window.addEventListener('load', func, true);
>>
>> would run for every load event on IMG, SCRIPT, LINK rel="stylesheet" 
>> etc. in the document.
>>
>> This is also implemented in Safari but not supported in Mozilla until 
>> recently (see bug 331306 - [1])
>>
>> While we think Opera's/Safari's implementation is correct according 
>> to the spec, a number of sites out there rely on Mozilla's bug and 
>> expect such an event listener to run only once.
>>
>> Mozilla developers have proposed a solution in bug 335251 [2]. They 
>> suggest that load events should not propagate to the "window" object 
>> in the browser's JavaScript environment.
>>
>> Pros of Mozilla's suggestion:
>>   - it's backwards compatible with existing content
>>
>> Cons:
>> - we introduce an inconsistency to the whole event listener model 
>> that means for example these two will mean very different things..
>>
>> window.addEventListener('click', func, true); // runs for any click 
>> event
>> window.addEventListener('load', func, true); // runs once only
>>
>>
>> It is not clear from the DOM Events spec how the "window" object fits 
>> into the capturing/bubbling. Could this be clarified? Which behaviour 
>> should be considered correct per the spec?
>>
>> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=331306
>>
>> [2] https://bugzilla.mozilla.org/show_bug.cgi?id=335251
>>
>> Commentary:
>> http://my.opera.com/hallvors/blog/2006/12/23/firechicken
>>
>
>
>
>
>
Received on Thursday, 28 December 2006 13:22:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT