qooxdoo 0.8 Event Layer

qooxdoo 0.8 will include a new, sophisticated low-level event layer. Not only does this separate layer allow for a clean architectural design (with a high-level GUI toolkit on top), it will also make it possible to use this reduced set of low-level DOM features without qooxdoo’s advanced widget system. Particularly for rather traditional web pages instead of full-featured rich internet applications, such a light-weight, standalone qooxdoo built might be more favorable. One central element for such a low-level layer is DOM event handling.

In qooxdoo 0.7, event handling is tightly integrated, rather intermingled, with the widget system. We have now taken the best parts of the old event handler, like key and mouse event normalization, and integrated them into a new standalone event layer.

This event layer has many interesting features. Unlike event layers commonly seen in other JavaScript libraries it does much more than just providing a cross-browser API wrapper for attaching event listeners:

We just did a presentation about this new event layer. Take a look at the Slides: qooxdoo 0.8 Event Layer [PDF] or at the corresponding wiki pages [5] for more information.

[1] http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow
[2] http://msdn2.microsoft.com/en-us/library/ms537630.aspx
[3] http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface
[4] http://qooxdoo.org/documentation/0.7/keyboard_events
[5] http://qooxdoo.org/documentation/general/dom_event_layer

2 thoughts on “qooxdoo 0.8 Event Layer

  1. I am immensely interested about how you guys are implementing a long standing annoyance – event capturing in IE.

  2. Hi,

    the basic idea to implement event capturing in IE is fairly simple. First you have to realize that event capturing is only needed for “bubbling” events. These events always bubble up to the document body.

    We have our own implementation of “addEventListener” which does not attach a native event listener to the given DOM element but instead uses a common event listener for this event on the document body. This common generic event listener receives all events of a type and by inspecting the event’s original event target it is able to build the chain of DOM nodes up to the body. With this information together with the knowledge of all event listeners we can do the dispatch ourselves. We simply walk from the body to the target and call all capturing event handler and then walk back from the target to the body to call the bubbling event listeners.

    There is always only one native event listener for each bubbling event of a type, which is attached to the body.