This feature has been deprecated. Use up.on()
with a callback that wraps the given native element in a jQuery collection.
Load unpoly-migrate.js
to polyfill deprecated features.
Listens to an event on document
or a given element.
The event handler is called with the event target as a
jQuery collection.
If you're not using jQuery, use up.on()
instead, which calls
event handlers with a native element.
up.$on('click', 'a', function(event, $link) {
console.log("Click on a link with destination %s", $element.attr('href'))
})
The element on which to register the event listener.
If no element is given, the listener is registered on the document
.
A space-separated list of event names to bind to.
The selector of an element on which the event must be triggered. Omit the selector to listen to all events with that name, regardless of the event target.
Whether to register a passive event listener.
A passive event listener may not call event.preventDefault()
.
This in particular may improve the frame rate when registering
touchstart
and touchmove
events.
The listener function that should be called.
The function takes the observed element as the first argument. The element's attached data is passed as a third argument.
A function that unbinds the event listeners when called.