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

DOM Level 3 Events

From: Emanuele D'Arrigo <manu3d@gmail.com>
Date: Sun, 17 May 2009 14:41:41 +0100
Message-ID: <915dc91d0905170641k20bb8e55w9d68439fba7bd982@mail.gmail.com>
To: www-dom@w3.org
Hi everybody, greetings from wet, windy and rainy UK! But no worries: we
-should- get a couple of weeks of summer in the next three months! ;)

Down to business:
I've spent the past few days sifting through the DOM Level 3 documents to
add Events support to pxdom <http://www.doxdesk.com/software/py/pxdom.html>,
a pure-python implementation of the Document Object Model. I'm finding
there's a bit of a gap in my understanding of the dispatch process and I
hope this is the right place where to ask some tips and tricks.

Specifically, once an event is created through Document.createEvent(), which
object is responsible for -orchestrating- the dispatch? I currently have two
options in mind:

1) the Document object does it all. It creates the event, initializes it,
establishes the routing and then iterates through targets and listeners
along the way and back.

2) the Document object creates, initializes and establish the routing, but
it then leaves the responsibility to the nodes on the way to the target to
recursively call the dispatchEvent() method on their appropriate children,
i.e.:

dispatchEvent(event)
     letCapturingListenersHandleTheEvent(event)
     nextTargetNode = event.getNextTargetFromRouting(thisTargetNode)
     nextTarget.dispatchEvent(event)
     letBubblingListenersHandleTheEventIfTheEventBubbles(event)

Is either way (or further alternatives) the intended or better way?

Manu
Received on Sunday, 17 May 2009 13:43:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:00 GMT