new Delegate(root)
DOM event delegator
The delegator will listen
for events that bubble up
to the root node.
Methods
-
root(root)
- (instance) Start listening for events
on the provided DOM element
-
captureForType(eventType)
-
on(...)
- (instance) Attach a handler to one
event for all elements
that match the selector,
now or in the future
The handler function receives
three arguments: the DOM event
object, the node that matched
the selector while the event
was bubbling and a reference
to itself. Within the handler,
'this' is equal to the second
argument.
The node that actually received
the event can be accessed via
'event.target'.
-
off(...)
- (instance) Remove an event handler
for elements that match
the selector, forever
-
handle(event)
- (instance) Handle an arbitrary event.
-
fire(...)
- (instance) Fire a listener on a target.
-
destroy
- (instance) Short hand for off()
and root(), ie both
with no parameters
Properties
-
listenerMap
- (type: Object)
Maintain a map of listener
lists, keyed by event name.
-
handle
- (type: function)
-
rootElement
- (type: Node)
The root node at which
listeners are attached.
Links
matches
Global Property
Type
Check whether an element
matches a generic selector.
Links
Delegate
Global Property
Links
matchesTag(tagName, element)
Global Function
Check whether an element
matches a tag selector.
Tags are NOT case-sensitive,
except in XML (and XML-based
languages such as XHTML).
Returns
Links
matchesRoot(selector, element)
Global Function
Check whether an element
matches the root.
Returns
Links
matchesId(id, element)
Global Function
Check whether the ID of
the element in 'this'
matches the given ID.
IDs are case-sensitive.
Returns
Links
Delegate#listenerMap
Instance Property
Type
Maintain a map of listener
lists, keyed by event name.
Links
Delegate#handle
Instance Property
Type
Links
Delegate#root(root)
Instance Method
Start listening for events
on the provided DOM element
Returns
-
Delegate
- This method is chainable
Links
Delegate#rootElement
Instance Property
Type
The root node at which
listeners are attached.
Links
Delegate#captureForType(eventType)
Instance Method
Returns
Links
Delegate#on(...)
Instance Method
Attach a handler to one
event for all elements
that match the selector,
now or in the future
The handler function receives
three arguments: the DOM event
object, the node that matched
the selector while the event
was bubbling and a reference
to itself. Within the handler,
'this' is equal to the second
argument.
The node that actually received
the event can be accessed via
'event.target'.
Returns
-
Delegate
- This method is chainable
Links
Delegate#off(...)
Instance Method
Remove an event handler
for elements that match
the selector, forever
Returns
-
Delegate
- This method is chainable
Links
Delegate#handle(event)
Instance Method
Handle an arbitrary event.
Links
Delegate#handle~EVENTIGNORE
Inner Property
Links
Delegate#fire(...)
Instance Method
Fire a listener on a target.
Returns
Links
Delegate#destroy
Instance Method
Short hand for off()
and root(), ie both
with no parameters
Returns
Links