wrld.js

DomEvent

Utility functions to work with the DOM events, used by Leaflet internally.

Methods

Method Returns Description
addListener( <HTMLElement> el, <String> type, <Function> fn, <Object> context? ) this Adds a listener fn to the element's DOM event of the specified type. this keyword inside the listener will point to context, or to the element if not specified.
removeListener( <HTMLElement> el, <String> type, <Function> fn ) this Removes an event listener from the element.
stopPropagation( <DOMEvent> e ) this Stop the given event from propagation to parent elements. Used inside the listener functions:
L.DomEvent.addListener(div, 'click', function (e) {
	L.DomEvent.stopPropagation(e);
});
preventDefault( <DOMEvent> e ) this Prevents the default action of the event from happening (such as following a link in the href of the a element, or doing a POST request with page reload when form is submitted). Use it inside listener functions.
stop( <DOMEvent> e ) this Does stopPropagation and preventDefault at the same time.
disableClickPropagation( <HTMLElement> el ) this Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown' and 'touchstart' events.
getMousePosition( <DOMEvent> e, <HTMLElement> container? ) Point Gets normalized mouse position from a DOM event relative to the container or to the whole page if not specified.
getWheelDelta( <DOMEvent> e ) Number Gets normalized wheel delta from a mousewheel DOM event.
v0.1.1335