src/event/events_core.js
function(nativeEvent, typeOverride) {
  var evt = eventWrapper(nativeEvent);
  if (typeOverride !== undefined) {
    evt.type = typeOverride;
  }
  var activePath = [];
  var elem = evt.target;
  var events;

  /**
   * Handle calling bound functions with the proper targets set
   * @TODO move this outside eventHandler
   * @param  {Element}         elem      DOM element to trigger events on
   * @param  {Array<Function>} funcArr   Array of bound functions to trigger
   * @param  {String}          selector  Selector string that the event was bound to
   * @param  {Element}         delegate  DOM element this event was bound to for delegation
   */
  var triggerEventFunctions = function(elem, funcArr, selector, delegate) {
    var result;
    evt.currentTarget = elem;
    evt.delegateTarget = delegate;
    for (var i = 0; i < funcArr.length; i++) {
      if (!evt.isImmediatePropagationStopped()) {
        evt.vEvent = {
          handler: funcArr[i].method,
          selector: selector
        };

        result = funcArr[i].method(evt);
        if (result === false) {
          falseHandler(evt);
        }
      }
    }
  };

  /**
   * Checks if bound events should fire
   * @param  {Object}    typeEvents        Event object of events to check if should fire
   */
  var checkEvents = function(typeEvents) {
    var elemClasses, elemClass;

    // Iterate over previously passed elements to check for any delegated events
    var activePathLength = activePath.length;
    for (var i = 0; i < activePathLength; i++) {
      elemClasses = activePath[i].classes;
      // Once stopPropagation is called stop
      if (!evt.isPropagationStopped()) {
        var elemClassesLength = elemClasses.length;
        for (var j = 0; j < elemClassesLength; j++) {
          elemClass = elemClasses[j];
          if (typeEvents[elemClass]) {
            triggerEventFunctions(activePath[i].element, typeEvents[elemClass], elemClass, elem);
          }
        }
      }
    }

    // Check for any non-delegated events
    if (!evt.isPropagationStopped() && typeEvents.self) {
      triggerEventFunctions(elem, typeEvents.self);
    }
  };

  while (elem && !evt.isPropagationStopped()) {
    events = module.exports.getEvents(elem);
    if (events) {
      // Generic events
      if (events[evt.type]) {
        checkEvents(events[evt.type]);
      }
    }
    // Create array of class names that match our pattern to check for delegation later
    var elemActiveClasses = module.exports.getActiveClasses(elem);
    if (elemActiveClasses.length) {
      activePath.push({
        element: elem,
        classes: elemActiveClasses
      });
    }
    elem = elem.parentNode;
  }
}
function(nativeEvent, typeOverride) {
  var evt = eventWrapper(nativeEvent);
  if (typeOverride !== undefined) {
    evt.type = typeOverride;
  }
  var activePath = [];
  var elem = evt.target;
  var events;

  /**
   * Handle calling bound functions with the proper targets set
   * @TODO move this outside eventHandler
   * @param  {Element}         elem      DOM element to trigger events on
   * @param  {Array<Function>} funcArr   Array of bound functions to trigger
   * @param  {String}          selector  Selector string that the event was bound to
   * @param  {Element}         delegate  DOM element this event was bound to for delegation
   */
  var triggerEventFunctions = function(elem, funcArr, selector, delegate) {
    var result;
    evt.currentTarget = elem;
    evt.delegateTarget = delegate;
    for (var i = 0; i < funcArr.length; i++) {
      if (!evt.isImmediatePropagationStopped()) {
        evt.vEvent = {
          handler: funcArr[i].method,
          selector: selector
        };

        result = funcArr[i].method(evt);
        if (result === false) {
          falseHandler(evt);
        }
      }
    }
  };

  /**
   * Checks if bound events should fire
   * @param  {Object}    typeEvents        Event object of events to check if should fire
   */
  var checkEvents = function(typeEvents) {
    var elemClasses, elemClass;

    // Iterate over previously passed elements to check for any delegated events
    var activePathLength = activePath.length;
    for (var i = 0; i < activePathLength; i++) {
      elemClasses = activePath[i].classes;
      // Once stopPropagation is called stop
      if (!evt.isPropagationStopped()) {
        var elemClassesLength = elemClasses.length;
        for (var j = 0; j < elemClassesLength; j++) {
          elemClass = elemClasses[j];
          if (typeEvents[elemClass]) {
            triggerEventFunctions(activePath[i].element, typeEvents[elemClass], elemClass, elem);
          }
        }
      }
    }

    // Check for any non-delegated events
    if (!evt.isPropagationStopped() && typeEvents.self) {
      triggerEventFunctions(elem, typeEvents.self);
    }
  };

  while (elem && !evt.isPropagationStopped()) {
    events = module.exports.getEvents(elem);
    if (events) {
      // Generic events
      if (events[evt.type]) {
        checkEvents(events[evt.type]);
      }
    }
    // Create array of class names that match our pattern to check for delegation later
    var elemActiveClasses = module.exports.getActiveClasses(elem);
    if (elemActiveClasses.length) {
      activePath.push({
        element: elem,
        classes: elemActiveClasses
      });
    }
    elem = elem.parentNode;
  }
}
function ( nativeEvent , typeOverride ) { var evt = eventWrapper ( nativeEvent ) ; if ( typeOverride !== undefined ) { evt . type = typeOverride ; } var activePath = [ ] ; var elem = evt . target ; var events ; /**
   * Handle calling bound functions with the proper targets set
   * @TODO move this outside eventHandler
   * @param  {Element}         elem      DOM element to trigger events on
   * @param  {Array<Function>} funcArr   Array of bound functions to trigger
   * @param  {String}          selector  Selector string that the event was bound to
   * @param  {Element}         delegate  DOM element this event was bound to for delegation
   */ var triggerEventFunctions = function ( elem , funcArr , selector , delegate ) { var result ; evt . currentTarget = elem ; evt . delegateTarget = delegate ; for ( var i = 0 ; i < funcArr . length ; i ++ ) { if ( ! evt . isImmediatePropagationStopped ( ) ) { evt . vEvent = { handler : funcArr [ i ] . method , selector : selector } ; result = funcArr [ i ] . method ( evt ) ; if ( result === false ) { falseHandler ( evt ) ; } } } } ; /**
   * Checks if bound events should fire
   * @param  {Object}    typeEvents        Event object of events to check if should fire
   */ var checkEvents = function ( typeEvents ) { var elemClasses , elemClass ; // Iterate over previously passed elements to check for any delegated events var activePathLength = activePath . length ; for ( var i = 0 ; i < activePathLength ; i ++ ) { elemClasses = activePath [ i ] . classes ; // Once stopPropagation is called stop if ( ! evt . isPropagationStopped ( ) ) { var elemClassesLength = elemClasses . length ; for ( var j = 0 ; j < elemClassesLength ; j ++ ) { elemClass = elemClasses [ j ] ; if ( typeEvents [ elemClass ] ) { triggerEventFunctions ( activePath [ i ] . element , typeEvents [ elemClass ] , elemClass , elem ) ; } } } } // Check for any non-delegated events if ( ! evt . isPropagationStopped ( ) && typeEvents . self ) { triggerEventFunctions ( elem , typeEvents . self ) ; } } ; while ( elem && ! evt . isPropagationStopped ( ) ) { events = module . exports . getEvents ( elem ) ; if ( events ) { // Generic events if ( events [ evt . type ] ) { checkEvents ( events [ evt . type ] ) ; } } // Create array of class names that match our pattern to check for delegation later var elemActiveClasses = module . exports . getActiveClasses ( elem ) ; if ( elemActiveClasses . length ) { activePath . push ( { element : elem , classes : elemActiveClasses } ) ; } elem = elem . parentNode ; } }
Function bound to all global level events
Function bound to all global level events