DOM2 Events addEventListener("load")

Is there a spec that defines when the DOM is in a state where it's safe to call addEventListener?

I assumed that a document should be able to get by using only DOM 2 Events, but since
addEventListener requires an EventTarget, and an EventTarget is a DOM Node, when
during the document load process is it safe to add an HTMLEvents::load handler?

Is the BODY onload attribute still necessary?

Is it correct to say that addEventListener for onLoad is called on the document although
the equivalent onLoad handler would be attached to the BODY tag?

Given the following, is there a spec that guarantees that the registration of the "load" event listener is safe?

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>sample</title>
	<script language="ecmascript">
		function myOnLoad(ev) {}
	</script>
</head>
<body id="body">
	<script language="ecmascript">
		// does any spec state that body would be DOM-addressable here within inline script?
		body.addEventListener("load", myOnLoad, false)
	</script>
</body>
</html>

--Brad Pettit
--Microsoft Corporation

Received on Wednesday, 22 May 2002 19:41:13 UTC