W3C home > Mailing lists > Public > public-webapi@w3.org > December 2006

Re: capturing load events

From: Shadow2531 <shadow2531@gmail.com>
Date: Fri, 29 Dec 2006 15:12:41 -0500
Message-ID: <6b9c91b20612291212m122849aq9fff3ef08eab2fa8@mail.gmail.com>
To: "Bjoern Hoehrmann" <derhoermi@gmx.net>
Cc: "Hallvord R. M. Steen" <hallvord@opera.com>, public-webapi@w3.org, "Joao Eiras" <joao.eiras@gmail.com>

On 12/29/06, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
> * Shadow2531 wrote:
> >So far, this is what I get out of everything:
> >
> >1. window.addEventListener("load", func, false) should fire only one
> >load event with the target being the document.
>
> Neither DOM Events nor Window currently allow or require that, the
> document's load event would either have to bubble or the model has
> to be so that during the target phase listeners on both the window
> and the document have to be triggered.

I meant that with:

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

, e.target should be the document like it currently is. (For some
reason I thought it used to be the window object in FF and it was
changed to be document like in Opera, but nevermind)

> >2. window.addEventListener("load", func, true) should do the exact
> >same thing as #1.
>
> That would be very bad,

That's what FF trunk does now though, no?

I thought someone said  that Opera's implementation of
window.addEventListener("load", func, "true") was NOT desired and it
needs to be changed. If it's not desired, what exactly do we want to
change with Opera's implementation? I like Opera's implementation as
is and FF matching it would be a good thing, but it looks like we're
going for more matching And tweaking, but not sure what's aimed to
being tweaked.

For example, with the following:

<!DOCTYPE html>
<html>
<head>
<title></title>
<script>
window.addEventListener("load", function(e) {
alert(e.target);
}, true);
</script>
</head>
<body>
<iframe src="about:blank"></iframe>
<iframe src="about:blank"></iframe>
</body>
</html>

, Opera fires for both iframes and the body. FF trunk fires just for
the document. Firing just for the document can be done  with false.
What would you like to change about how Opera does it? ( Thanks for
your patience)

> >5. 'true' will just be a dummy value when used on a window object (and
> >in essence, just mapped to 'false') to make some current pages work
> >that should really be using 'false'.
>
> So far the 'load' event is supposed to be an exception, I do not
> think anyone suggested this point for all event types.

Correct. I was just unclear about that. I meant only in the case of
load, so far.

> >6. Instead of window.addEventListener("load", func, true),
> >document.addEventListener("load", func, true) will need to be used if
> >you really want capturing for the document.
>
> Presumably, yes. Though note that in this case `func` will only
> be triggered for load events on descendants of the document,
> not for the document's load event.

Right. That's the same thing that happens with
window.addEventListener("load", func, 'true') in Opera now; a load
event is fired for the doc's descendants, but not the doc. So, unless
I'm mistakin, document.addEventListener("load", func, "true") would be
an exact replacement.

Thanks

-- 
burnout426
Received on Friday, 29 December 2006 20:12:51 GMT

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