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

capturing load events

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Thu, 28 Dec 2006 01:00:23 +0100
To: www-dom@w3.org
Cc: mjs@apple.com, "Joao Eiras" <joao.eiras@gmail.com>
Message-ID: <op.tk8syx1pa3v5gv@hr-opera.oslo.opera.com>

I have a request for clarification regarding the behaviour of capturing  

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

- 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


Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
Opera - simply the best Internet experience
Received on Wednesday, 27 December 2006 23:59:53 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:13 UTC