W3C home > Mailing lists > Public > public-webapi@w3.org > January 2007

Re: capturing load events

From: Shadow2531 <shadow2531@gmail.com>
Date: Mon, 1 Jan 2007 17:14:56 -0500
Message-ID: <6b9c91b20701011414h3d60112fseedd388134b7b8ea@mail.gmail.com>
To: "João Eiras" <joao.eiras@gmail.com>
Cc: "Bjoern Hoehrmann" <derhoermi@gmx.net>, "Hallvord R. M. Steen" <hallvord@opera.com>, public-webapi@w3.org
On 12/31/06, João Eiras <joao.eiras@gmail.com> wrote:
> > So, my question is, what's the reason for not wanting win t+b(2) to
> fire?
> The load event doesn't bubble, so it fires with the Document as
> target, and doesn't go up. But compatibility with the current web
> demands this.

Thanks João.

O.K., so we're just saying that window.addEventListener("load", func,
false) doesn't make sense, *technically*, because the document load
doesn't bubble up to the window.

So, it seems that:
win cap (1) ([object HTMLImageElement])
doc cap (1) ([object HTMLImageElement])
win cap (1) ([object HTMLDocument])
doc t+b (2) ([object HTMLDocument])
win t+b (2) ([object HTMLDocument])

is the way to go because it doesn't break the 'false' behavior and it
allows 'true' to work as mosts sites intend. (Opera can produce that
with the body -> document target fixes.)

Assuming the 'true' +"load" behavior for window.addEventListener is
solved, the the only problem is how to explain how
window.addEventListener("load", func, false) can work if load doesn't
bubble.

So, since we still need  window.addEventListener("load", func, false)
to work, can we just have the window spec say that in the case of
"load" and 'false' for window.addEventListener,
window.addEventListener("load", func, false) is just an alias to
document.addEventListener("load", func, false)?

That appears to be what Opera does anyway (or close to it)

window.addEventListener("load", function() {
alert(this);
}, false);

'this' is HTMLDocument in Opera. In FF it's 'window'.

And with:

function test() {
alert("test");
}
window.addEventListener("load", test, false);
document.removeEventListener("load", test, false);

you won't see an alert in Opera.

-- 
burnout426
Received on Monday, 1 January 2007 22:15:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:56 GMT