Re: updated definition of DOM Event I/O Processor

Forgot to change the adress again… Why is there a Reply-To the sender anyway, instead of From the sender and Reply-To the mailing list?


E.3 DOM Event I/O Processor
 
The DOM Event I/O processor handles communication between SCXML interpreters and nodes in documents that implement the DOM (such as HTML and many XML languages, but not SCXML itself). An example of this would be a document containing both SCXML and HTML markup. In such a case, each language retains its own context and its own independent semantics. (For example, SCXML's event processing algorithm is not affected by the fact that there is HTML markup elsewhere in the document). It is however useful for the two languages to be able to communicate by sending events back and forth, so that the Web browser can notify SCXML when the user clicks on a button, and the SCXML interpreter can notify the appropriate HTML element when it is time to place a certain field in focus, etc. The DOM Event I/O processor handles this communication by means of DOM Events [DOMEvents], which are a general means for information propagation in XML documents. Note that we do not require that the SCXML document be represented in the other markup's DOM (though it may be).

E.3.1 Sending Events

The SCXML author can send a DOM event to any node in the document by selecting the DOM Event I/O processor (type="DOM") and specifying the node as the target. Processors MUST support CSS selector [http://www.w3.org/TR/selectors/] notation for specifying the node, and MAY support XPath or other notations. The SCXML Processor MUST use the value of the 'event' attribute as the type of the DOM event, and send events that implement the CustomEvent interface. The processor MUST set the 'cancellable' property of the event to false. If a name in the namelist or a <param>'s name is 'bubbles', its Boolean value is used as the value of the 'bubbles' DOM event property; otherwise, the Processor MUST set that property to true. The Processor MUST populate the 'details' property of the event with the names and values specified via "namelist" and/or <param>. If <content> is present, only the contents of the <content> element are used as the value of the 'details' property. If the 'target' attribute's value is not a valid expression of a language supported by the implementation (e.g. a CSS Selector), or if the specified target doesn't exist or cannot be reached, the SCXML Processor MUST place the error error.communication in the internal event queue.

E.3.2 Receiving Events

The SCXML Processor MUST implement a public method receiveEvent, which takes a mandatory argument that implements the DOM Event interface. Whenever that method is called with a valid argument, and the SCXML instance is still running, the SCXML Processor MUST convert the argument to an SCXML event and place it in the external queue. The receiveEvent method MAY support other types of arguments.

In cases where the SCXML interpreter is represented in the DOM of the containing document, it MAY implement the public methods addEventConverter and removeEventConverter, described below. If it does, then, if running, it MUST convert any DOM Event reaching the SCXML representation in the containing DOM whose type belongs to the set of registered types, and then place the converted event in the external queue. The SCXML Processor MUST ignore DOM events targeted at other nodes in the SCXML markup.
scxml.addEventConverter(String type) : adds 'type' to the set of registered events for that SCXML Processor.
scxml.removeEventConverter(String type) : removes 'type' from the set of registered events for that SCXML Processor.
To convert a DOM Event, the Processor MUST use the type of the DOM event as the name of the SCXML event. It MUST also place a shallow copy of the DOM event in the _event.data field.

E.3.3 _ioprocessors Value

The entry for the DOM Event I/O Processor inside the _ioprocessors system variable MUST be "DOM" for processing according to the above definitions. Implementations may implement multiple I/O processors for DOM Events (e.g. to allow authors to send events that are not CustomEvents).

 
			David

Received on Friday, 12 October 2012 13:40:19 UTC