W3C home > Mailing lists > Public > www-svg@w3.org > December 1999

Concrete proposal for MVC-capable DOM event flow

From: Raph Levien <raph@onan.artofcode.com>
Date: Wed, 15 Dec 1999 12:21:19 -0800
Message-Id: <199912152021.MAA06384@onan.artofcode.com>
To: www-svg@w3.org
Cc: Philippe Le Hegaret <plh@w3.org>
Hello SVG'ers,

   Philippe Le Hegaret was kind enough to invite me to write up a
concrete proposal for a DOM event flow that would support a
Model/View/Controller architecture with multiple Views. I am very much
interested in feedback from other implementors of DOM for SVG, to make
sure that this proposal is not gratuitously different than what anyone
else is doing. At this point, I am not requesting that it be adopted
by the W3C. If implementation experience is positive, then it is easy
to imagine it being the basis for a future DOM recommendation.

   My proposal follows.

Raph


Interface EventGroup

The EventGroup interface is simply a placeholder for separating the
event flows when there are multiple groups of listeners for a DOM
tree.

Event listeners can be registered without an EventGroup using the
existing EventTarget interface, or with an associated EventGroup using
the new EventTargetGroup interface. When an event is dispatched, it is
dispatched independently to each EventGroup. In particular, the
stopPropagation method of the Event interface only stops propagation
for event listeners without an associated EventGroup. Correspondingly,
the stopPropagation method of EventGrouped only stops propagatation
for event listeners within the specified EventGroup.


Interface EventTargetGroup

The EventTargetGroup interface is implemented by the same set of
objects that implement the EventTarget interface, namely all Nodes in
in implementation which supports the Event model and the EventGroup
extension.

interface EventTargetGroup {
   void               addEventListener(in DOMString type,
                                       in EventListener listener,
                                       in boolean useCapture,
				       in EventGroup eventGroup);
   void               removeEventListener(in DOMString type, 
                                          in EventListener listener, 
                                          in boolean useCapture,
				          in EventGroup eventGroup);
};

Methods

   addEventListener

   This method is equivalent to the addEventListener method of the
   EventTarget interface, with the exception of the added eventGroup
   parameter. The listener is registered with this EventGroup
   associated.

   Parameters

      EventGroup eventGroup   The EventGroup to associate with the
                              listener.

      (all other parameters as in EventTarget::addEventListener)

   removeEventListener

   This method is equivalent to the removeEventListener method of the
   EventTarget interface, with the exception of the added eventGroup
   parameter. The listener registered with this EventGroup associated
   is removed.

   Parameters

      EventGroup eventGroup   The EventGroup associated with the 
                              listener.

      (all other parameters as in EventTarget::removeEventListener)


Interface EventGrouped

The EventGrouped interface is implemented by all Event objects.

interface EventGrouped {
   void          stopPropagation(EventGroup eventGroup);
};

Methods

   stopPropagation

   The stopPropagation method is used prevent further propagation of
   an event during event flow within an EventGroup. If this method is
   called by any EventListener the event will cease propagating
   through the tree within the specified EventGroup. The event will
   complete dispatch to all listeners on the current EventTarget
   before event flow stops. This method may be used during any stage
   of event flow. Event propagation for other EventGroups, or
   listeners not associated with any EventGroup, is not affected.

   Parameters

      EventGroup eventGroup   The EventGroup in which to stop event
                              propagation.

   No Return Value

   No Exceptions


Interface DocumentEventGroup

The DocumentEventGroup interface provides a mechanism by which the
user can create an EventGroup of a type supported by the
implementation. It is expected that the DocumentEvent interface will
be implemented on the same object which implements the Document
interface in an implementation which supports the EventGroup
extension.

interface DocumentEventGroup {
   EventGroup createEventGroup();
};

Methods

   createEventGroup

   This method creates a new EventGroup for use in the
   addEventListener and removeEventListener methods of the
   EventTargetGroup interface.

   No Parameters

   Return Value

      EventGroup   The newly created EventGroup.

   No Exceptions
Received on Wednesday, 15 December 1999 15:20:56 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:18 GMT