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

RE: What should the "load" event be attached to?

From: Philippe Le Hegaret <plh@w3.org>
Date: 02 Jun 2003 14:21:47 -0400
To: Ian Hickson <ian@hixie.ch>
Cc: WWW DOM <www-dom@w3.org>
Message-Id: <1054578107.7994.29.camel@jfouffa.w3.org>

> The DOM2 Events specification appears to be unclear about exactly
> which objects the "load" event applies to.

This has been (hopefully) clarified in the DOM Level 3 Events

> In a pure XML context, is it the root element, or the document itself,
> that receives this event?

The load event can be dispatch to an Element node:

> In an (X)HTML context, does the body element get the event?

Given the compatibility between XHTML 1.0 and HTML 4, the list of
possible targets for the load event is:
HTMLBodyElement, HTMLFrameSetElement, HTMLObjectElement,
HTMLLinkElement, HTMLMetaElement, HTMLScriptElement, HTMLFrameElement,
HTMLIFrameElement, HTMLImageElement

> If the latter, then how does one attach a load event to a document
> before the body node has been loaded into the document? (As is common
> with load events, since the document is typically not going to be
> fully loaded when the event is attached.)

The load event, as defined in HTML 4 using the onload attribute, was
designed for the FRAMESET and BODY elements. We extended the concept in
DOM to address other "objects". I believe that your functionality is
addressed in the Load and Save module:
Events supported by asynchronous DOMBuilder objects are:
 * load: The document that's being loaded is completely parsed, see the
   definition of LSLoadEvent
 * progress: Progress notification, see the definition of

In other words, the target is not the Document, but the object used to
build the Document.

> Some clarifications to the DOM2 Events specification would be very
> useful.

Correct, it would be good to put it on our errata list for DOM Level 2
Events at some point. We are giving priorities to DOM Level 3 for the
moment (over DOM Level 1 Second Edition or DOM Level 2 errata).

Received on Monday, 2 June 2003 14:21:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:51 UTC