W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2002

DOM2 Events addEventListener("load")

From: Brad Pettit <bradp@microsoft.com>
Date: Wed, 22 May 2002 16:40:41 -0700
Message-ID: <3013537455C0D1459746B2AE2DF47AEA0521F1D8@svc-msg-01.northamerica.corp.microsoft.com>
To: <www-dom@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT