Re: capturing load events

On Thu, 28 Dec 2006 16:33:43 +0100, Bjoern Hoehrmann <derhoermi@gmx.net>  
wrote:

> * Hallvord R. M. Steen wrote:
>> 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?

> http://dev.w3.org/cvsweb/2006/webapi/Window/publish/Window.html says the
> window event flow is the same as the DOM Event Flow except that `window`
> is considered a parent of the Document it contains and that load events
> trigger load listeners only if the event's target is the Window. I think
> this answers all of your and João's questions.

Thanks, I think so (I'll let João speak for himself if not :). It also  
says explicitly in the spec that this is done for backwards compatibility  
with problems caused by bugs in certain implementations. I'll have to make  
sure Opera implements this too (about time we have a proper solution for  
the buggy capturing scripts out there :-( )

While I'm looking at the spec I'll do a bit of proofreading:

* 1st paragraph after heading "3 Events": Window objects are also an event  
target

I'm not a native speaker but shouldn't the singular/plural forms match, so  
either "window objects are also event targets" or "a window object is also  
an event target"?

* 2nd paragraph: the value of the view attribute of the event is be the  
Window object

Fix "is be".

> It also means that a
>
>   window.addEventListener('load', func, true);
>
> listener would never be triggered. Presumably that should be changed
> to say that it would be triggered only if the event's target is the
> Document. Do you see any problem with that?

No, I agree it should change.

-- 
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience

Received on Thursday, 28 December 2006 22:23:59 UTC