28. XML Events Module


This section is informative.

The XML Events Module defines a linkage between XHTML and the XML Document Object Model [DOM]. XML Events are defined in [XMLEVENTS], and all XML Event elements and attributes are in their own namespace.

When this module is selected, the ev:listener element is added to the content model of the head element as defined in the Document Module.

28.1. Events

This module also defines the Events Attribute Collection via the global attributes from [XMLEVENTS]. The normative definition of those attributes and their semantics is included in that specification. They are described briefly below:

defaultAction = "cancel|perform"
This attribute defines whether or not the default action associated with the event should be processed. The default value is perform
event = CDATA
This attribute defines the event type that is being listened for. The set of legal names for XHTML 2 is to be defined.

List of XHTML 2 Events Needed

We need to define the list of XHTML 2 events and map them into the XHTML DOM. activate, load, focusIn, focusOut, ...
handler = IDREF
This attribute specifies the ID of a handler element that defines the action that should be performed if the event reaches the observer.
observer = IDREF
This attribute specifies an ID for an observer element for which the listener is to be registered.
phase = "capture|default"
This attribute specifies the phase of event propagation in which to process the event. If not specified, the default value of this attribute is default.
propagate = "stop|continue"
This attribute specifies whether an event should stop propagating after this observer processes it, or continue for possible further processing. The default value of this attribute is continue.
target = IDREF
This attribute specifies the id of the target element of the event (i.e., the node that caused the event). If not specified, the default value of this attribute is the element on which the event attribute is specified.

Note that these attributes are not in the XHTML namespace but in the XML Events namespace. The XHTML namespace is the default namespace for XHTML documents, so XHTML elements and attributes may be expressed without namespace prefixes (although they are permitted on elements). XML Events attributes MUST use a prefix, since they are not in the default namespace of the document.

Implementation: RELAX NG, XML Schema, DTD