code: function (obj, type, fn, context) { // (HTMLElement, String, Function[, Object])
  
  		var id = L.stamp(fn),
  		    key = '_leaflet_' + type + id,
  		    handler, originalHandler, newType;
  
  		if (obj[key]) { return this; }
  
  		handler = function (e) {
  			return fn.call(context || obj, e || L.DomEvent._getEvent());
  		};
  
  		if (L.Browser.pointer && type.indexOf('touch') === 0) {
  			return this.addPointerListener(obj, type, handler, id);
  		}
  		if (L.Browser.touch && (type === 'dblclick') && this.addDoubleTapListener) {
  			this.addDoubleTapListener(obj, handler, id);
  		}
  
  		if ('addEventListener' in obj) {
  
  			if (type === 'mousewheel') {
  				obj.addEventListener('DOMMouseScroll', handler, false);
  				obj.addEventListener(type, handler, false);
  
  			} else if ((type === 'mouseenter') || (type === 'mouseleave')) {
  
  				originalHandler = handler;
  				newType = (type === 'mouseenter' ? 'mouseover' : 'mouseout');
  
  				handler = function (e) {
  					if (!L.DomEvent._checkMouse(obj, e)) { return; }
  					return originalHandler(e);
  				};
  
  				obj.addEventListener(newType, handler, false);
  
  			} else if (type === 'click' && L.Browser.android) {
  				originalHandler = handler;
  				handler = function (e) {
  					return L.DomEvent._filterClick(e, originalHandler);
  				};
  
  				obj.addEventListener(type, handler, false);
  			} else {
  				obj.addEventListener(type, handler, false);
  			}
  
  		} else if ('attachEvent' in obj) {
  			obj.attachEvent('on' + type, handler);
  		}
  
  		obj[key] = handler;
  
  		return this;
  	}
docs: /* inspired by John Resig, Dean Edwards and YUI addEvent implementations