Re: capturing load events

On Tue, 02 Jan 2007 02:16:29 +0100, Shadow2531 <shadow2531@gmail.com>  
wrote:

>> Reference for TC:  
>> <http://lists.w3.org/Archives/Public/public-webapi/2006Dec/0127>
>> 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.)

Opera actually fires a "load" event on BODY for compatibility with typical  
DOM0 <BODY onload="..."> code. This extra compatibility effort doesn't  
seem to be necessary since both IE6 and Firefox say "true" for the document

<body onload="alert(this==window)"></body>

so let's consider it a bug ;-p

> doc cap (1) ([object HTMLImageElement])
> win cap (2) ([object HTMLDocument])
> doc t+b (2) ([object HTMLDocument])
> win t+b (2) ([object HTMLDocument])
>
> That result would be more like what sites expect even if it doesn't seem  
> right.

Yes, it's wrong but web-compatible.

I suggest this text:

     However, conforming implementations MUST NOT dispatch "load" events in  
the
     null namespace that target the Document or any of its descendant DOM  
nodes
     to the Window object, in either the capture or bubble phases.

changed to

Implementations MUST NOT dispatch "load" events in the null namespace that  
target the document's descendants to the Window object. However, the  
document's "load" event bubbles to the Window.

(alternative: we could specify dispatching a "clone" event in the  
AT_TARGET phase to the Window, if we don't like making "load" bubble only  
for document->window bubbling.)

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

Received on Wednesday, 3 January 2007 11:46:20 UTC