Resp.: capturing load events

Thank Bjoern,
so, so far I've undestood this, regarding the load event:
1) the window is a target to which event listeners can be dispatched,
different from the document
2) a capturing load event listener in the window will only fire once,
during the load event dispatch for the document
3) a bubbling load event listener in the window will only fire once
when its child document loads. The load event for the document bubbles
to the window only. This is the single exception for the load event in
the entire events specification, where load bubbles. currentTarget
must be the window, the phase must be bubbling

Sadly, 2 is different from the original model, but it's required to
workaround the problems that unwanted event capture caused, due to the
Gecko bug.

Now, how do these rules apply related to other events and the unload event ?

2006/12/30, Shadow2531 <shadow2531@gmail.com>:
> On 12/29/06, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
> > * Shadow2531 wrote:
> > >[...]
> >
> > Try this fragment...
>
> Thanks
>
> Adressing the window + 'true' part first:
>
> <pre id='r'>&#xa;</pre>
> <script>
> function trace(s)
> {document.getElementById('r').firstChild.nodeValue+=s+"\n";}
> window.addEventListener('load',function(e){
> var t=e.target;
> if(window.opera&&t==document.body){t=document;}
> trace("win cap ("+e.eventPhase+") ("+t+")");},true);
> </script>
> <p><img alt='' src='http://www.w3.org/Icons/valid-xhtml10' /></p>
>
> Given that markup,  does Opera produce the desired result?
>
> --
> burnout426
>

Received on Sunday, 31 December 2006 01:02:43 UTC