src/js/dom.js
function (selector, event, handler, scope) {
  (scope || document).addEventListener(event, function(event) {
    var listeningTarget = closest(event.target, selector)
    if (listeningTarget) {
      handler.call(listeningTarget, event)
    }
  })
}
function (selector, event, handler, scope) {
  (scope || document).addEventListener(event, function(event) {
    var listeningTarget = closest(event.target, selector)
    if (listeningTarget) {
      handler.call(listeningTarget, event)
    }
  })
}
function ( selector , event , handler , scope ) { ( scope || document ) . addEventListener ( event , function ( event ) { var listeningTarget = closest ( event . target , selector ) if ( listeningTarget ) { handler . call ( listeningTarget , event ) } } ) }
An event handler.

@callback eventHandler
@param {Event} event - The event this handler was triggered for
 
Delegates an event for a node matching a selector.
@param {string} selector - The CSS selector
@param {string} event - The event name
@param {eventHandler} handler - The event handler function
@param {HTMLElement} [scope=document] - Element to add the event listener to
@private
An event handler .