XML Events Attributes

Release 2.0 - ...

All XForms Action elements explicitly allow global attributes from the XML Events namespace (http://www.w3.org/2001/xml-events), and apply the processing defined in that specification in section 2.3.

These global attributes are listed below.

event

The required event attribute specifies the event for which the listener is being registered.

observer

The optional observer attribute specifies the id of the element with which the event listener is to be registered. If this attribute is not present, the observer is the element that the event attribute is on, or the parent of that element.

target

The optional target attribute specifies the id of the target element of the event (i.e., the node that caused the event). If this attribute is present, only events that match both the event and target attributes will be processed by the associated event handler. Clearly because of the way events propagate, the target element should be a descendent node of the observer element, or the observer element itself.

handler

The optional handler attribute specifies the URI reference of a resource that defines the action that should be performed if the event reaches the observer. If this attribute is not present, the handler is the element that the event attribute is on.

phase

The optional phase attribute specifies when the listener will be activated by the desired event:

  • capture: Listener is activated during capturing phase.
  • default: Listener is activated during bubbling or target phase.

The default behavior is phase="default".
Note that not all events bubble, in which case with phase="default" you can only handle the event by making the event's target the observer.

propagate

The optional propagate attribute specifies whether after processing all listeners at the current node, the event is allowed to continue on its path (either in the capture or the bubble phase):

  • stop: Event propagation stops.
  • continue: Event propagation continues (unless stopped by other means, such as scripting, or by another listener).

The default behavior is propagate="continue".

defaultAction

The optional defaultAction attribute specifies whether after processing of all listeners for the event, the default action for the event (if any) should be performed or not:

  • cancel: If the event type is cancelable, the default action is cancelled.
  • perform: The default action is performed (unless cancelled by other means, such as scripting, or by another listener).

The default value is defaultAction="perform".
Note that not all events are cancelable, in which case this attribute is ignored.