GUACAMOLE-1204: Provide convenience function for cancelling DOM events.

This commit is contained in:
Michael Jumper committed 2021-05-27 14:43:22 -07:00
1 parent 6644955fff
commit 568355140d
2 files changed
+21 -13

No files matched your search

@@ -125,6 +125,20 @@ Guacamole.Event.DOMEvent = function DOMEvent(type, events) {
};
/**
* Convenience function for cancelling all further processing of a given DOM
* event. Invoking this function prevents the default behavior of the event and
* stops any further propagation.
*
* @param {Event} event
* The DOM event to cancel.
*/
Guacamole.Event.DOMEvent.cancelEvent = function cancelEvent(event) {
event.stopPropagation();
if (event.preventDefault) event.preventDefault();
event.returnValue = false;
};
/**
* An object which can dispatch {@link Guacamole.Event} objects. Listeners
* registered with {@link Guacamole.Event.Target#on on()} will automatically