Namespace Jelo.Event
Cross-browser registration of event handlers, automatically normalizes the event object to provide web
standard features such as preventDefault() and stopPropagation().
Defined in: Jelo.Event.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Jelo.Event.add(element, eventName, handler)
Start listening for an event.
|
<static> |
Jelo.Event.isFixed()
|
<static> |
Jelo.Event.normalize()
|
<static> |
Jelo.Event.onReady(fn)
Fires after all elements in the document is available.
|
<static> |
Jelo.Event.rem()
Alias for Jelo.Event.remove.
|
<static> |
Jelo.Event.remove(element, eventName, handler)
Stop listening for an event.
|
Method Detail
<static>
Jelo.Event.add(element, eventName, handler)
Start listening for an event. Multiple listeners can be registered to a single element. Can be accessed via
Jelo.on.
- Parameters:
- {HTMLElement} element
- HTML element to which Jelo should listen.
- {String} eventName
- The type of event for which Jelo should listen, such as "click" or "mouseup". Should be all lowercase, and WITHOUT the IE prefix "on".
- {Function} handler
- Method to be invoked when the event occurs. The execution scope ("this") will be
the actual element that caught the event which, due to the DOM hierarchy, may be a child of the
element registered via this function. The function is passed the following arguments:
- target: The element that caught the event.
- event: The event object, normalized to conform to W3C standards.
<static>
Jelo.Event.isFixed()
<static>
Jelo.Event.normalize()
- Deprecated:
- Bootstrap the next version of Jelo.Event.add and Jelo.Event.remove. The only difference you should notice as a developer is that the arguments passed to the OLD event handler were (target, event). The NEW arguments are (event) to fit in line with most implementations out there. See also: {@link Jelo.Event.isFixed}.
<static>
Jelo.Event.onReady(fn)
Fires after all elements in the document is available. In most cases, this function may be executed before
window.onload and before images fully load, which can result in a faster page response time.
- Parameters:
- fn
- See:
- Jelo#onReady
<static>
Jelo.Event.rem()
Alias for Jelo.Event.remove.
<static>
Jelo.Event.remove(element, eventName, handler)
Stop listening for an event. Safe to call even if no such listener has been registered. Can be accessed via
Jelo.un.
- Parameters:
- {HTMLElement} element
- HTML element to which Jelo should listen.
- {String} eventName
- The type of event for which Jelo should listen, such as "click" or "mouseup". Should be all lowercase, and WITHOUT the IE prefix "on".
- {Function} handler
- Method to be invoked when the event occurs. Anonymous handlers cannot be unregistered at this time.