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"
<html lang='en' xmlns="http://www.w3.org/1999/xhtml">
	<script language="ecmascript">
		function myOnLoad(ev) {}
<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)

--Brad Pettit
--Microsoft Corporation
Received on Wednesday, 22 May 2002 19:41:13 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:10 UTC