Observe and respond to DOM events efficiently
JavaScript HTML
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


DOMResponder Build Status

NOTE: This project is deprecated and is no longer mantained.

Observe and respond to DOM events efficiently.

This library is a low-level component to be used in hierarchial views. The concept is very simple. Multiple instances can be linked together and declare their events individually. No matter how many click events the instances along the tree listen, only one click is attached to the DOM by the root instance.

The root instance effictivelly manages all descendants events, taking the delegation one step further. This allows descendants view to listen to their own events without having to worry about how many events are attached to the DOM.



Returns the element associated with the instance.

.on(event, fn, [context])

Register an event listener fn (with the option to pass a context). The event name can contain a selector to be used for delegation (e.g.: click li.item will listen for clicks in li elements with the item class)

.off([event], [fn], [context])

Remove event listener fn that was added with context. If no fn is passed, removes all listeners for event or all the emitter listeners if no event is passed.

.hasListener(event, [fn])

Checks if the listener fn for event event is registered. If no fn is passed, returns true if at least one listener is registered for event.


Adds a responder as its child.


Removes a responder as its child.


Removes all child responders.


Check if a responder is a child of the instance.


Listen to all registered events as well as descendant events, acting as a proxy to them.


Stops listening to all registered events as well as descendant events.


Check if the instance is currently listening for events.


Check if the instance is not listening but has a manager proxying the events for it.


Destroys the instance. Stops and remove listeners, removes all children and cleans other resources.

How to use

For now, this library is only available in the AMD format. DomResponder depends on events-emitter, jquery and has.

If you use RequireJS specify them like this:

// ...
paths : {
   'events-emitter': '../bower_components/events-emitter/src',
   'has': '../bower_components/has/has'
   'jquery': '../bower_components/jquery/jquery'
// ...

Note that if you want to support IE8 you will need to install es5-shim and require both es5-shim and es5-sham with your AMD loader before requiring this library.


  1. bower install
  2. npm install
  3. npm test

You will need bower to install the library dependencies.


Released under the MIT License.