index.js
function handleElement(element, type, fn, capture) {
  if (!element || typeof element.addEventListener !== 'function') throw new TypeError('Cannot bind event ' + inspect(type) + ' to ' + inspect(element));
  if (typeof type !== 'string') throw new TypeError('Event type must be a string, e.g. "click", not ' + inspect(type));
  if (typeof fn !== 'function') throw new TypeError('`fn` (the function to call when the event is triggered) must be a function, not ' + inspect(fn));
  if (capture !== undefined && capture !== false && capture !== true) {
    throw new TypeError('`capture` must be `undefined` (defaults to `false`), `false` or `true`, not ' + inspect(capture));
  }

  function onEvent(e) {
    e.delegateTarget = element;
    return fn(element, e);
  }
  element.addEventListener(type, onEvent, capture || false);
  return element.removeEventListener.bind(element, type, onEvent, capture || false);
}
function handleElement(element, type, fn, capture) {
  if (!element || typeof element.addEventListener !== 'function') throw new TypeError('Cannot bind event ' + inspect(type) + ' to ' + inspect(element));
  if (typeof type !== 'string') throw new TypeError('Event type must be a string, e.g. "click", not ' + inspect(type));
  if (typeof fn !== 'function') throw new TypeError('`fn` (the function to call when the event is triggered) must be a function, not ' + inspect(fn));
  if (capture !== undefined && capture !== false && capture !== true) {
    throw new TypeError('`capture` must be `undefined` (defaults to `false`), `false` or `true`, not ' + inspect(capture));
  }

  function onEvent(e) {
    e.delegateTarget = element;
    return fn(element, e);
  }
  element.addEventListener(type, onEvent, capture || false);
  return element.removeEventListener.bind(element, type, onEvent, capture || false);
}
function handleElement ( element , type , fn , capture ) { if ( ! element || typeof element . addEventListener !== 'function' ) throw new TypeError ( 'Cannot bind event ' + inspect ( type ) + ' to ' + inspect ( element ) ) ; if ( typeof type !== 'string' ) throw new TypeError ( 'Event type must be a string, e.g. "click", not ' + inspect ( type ) ) ; if ( typeof fn !== 'function' ) throw new TypeError ( '`fn` (the function to call when the event is triggered) must be a function, not ' + inspect ( fn ) ) ; if ( capture !== undefined && capture !== false && capture !== true ) { throw new TypeError ( '`capture` must be `undefined` (defaults to `false`), `false` or `true`, not ' + inspect ( capture ) ) ; } function onEvent ( e ) { e . delegateTarget = element ; return fn ( element , e ) ; } element . addEventListener ( type , onEvent , capture || false ) ; return element . removeEventListener . bind ( element , type , onEvent , capture || false ) ; }
Bind `element` event `type` to `fn`.

@param {Element} element
@param {String} type
@param {Function} fn
@param {Boolean} capture
@return {Function}
@api public
Bind element event type to fn .