Re: ACTION-70: Define the scope chain of onFoo events reference issue-1

Hello,

> 3) The current order of handlers execution is different in different browsers 
>    (take onload event that is first handled on window and then on body in IE, while fired first on body and then on window in Mozilla)

A test case for the problem mentioned:

IE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script>
window.attachEvent("onload", function(){alert('window')})
</script>
</HEAD>
<BODY onload="alert('body')">
</BODY>
</HTML>

Gecko:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script>
window.addEventListener("load", function(){alert('window')}, false)
</script>
</HEAD>
<BODY onload="alert('body')">
</BODY>
</HTML>

In IE you will get 'body', 'window' (probably bug)
In Gecko: 'window', 'body'

This wrong order happens to IE only when the handler is attached within <head> section. once you moved your script to <body> everythng gets correct

But in any case, has the mechanism of "moving" event handlers from body/html tags to window object been defined?
Since there are several ways of achieving the desired effect (order of handlers processing), there should also be the definition of the logic done.
Will the handlers be moved to window, to document? Or the event will be dispatched with the target <body /> ?

Sergey Ilinsky,
Core Architect,
BackBase B.V.

Received on Wednesday, 15 March 2006 11:13:30 UTC