packages/rebound-utils/lib/events.js
function getCallbacks(target, delegate, eventType){
  var callbacks = [];
  if(target.delegateGroup && EVENT_CACHE[target.delegateGroup][eventType]){
    _.each(EVENT_CACHE[target.delegateGroup][eventType], function(callbacksList, delegateId){
      if(_.isArray(callbacksList) && (delegateId === delegate.delegateId || ( delegate.matchesSelector && delegate.matchesSelector(delegateId) )) ){
        callbacks = callbacks.concat(callbacksList);
      }
    });
  }
  return callbacks;
}
function getCallbacks(target, delegate, eventType){
  var callbacks = [];
  if(target.delegateGroup && EVENT_CACHE[target.delegateGroup][eventType]){
    _.each(EVENT_CACHE[target.delegateGroup][eventType], function(callbacksList, delegateId){
      if(_.isArray(callbacksList) && (delegateId === delegate.delegateId || ( delegate.matchesSelector && delegate.matchesSelector(delegateId) )) ){
        callbacks = callbacks.concat(callbacksList);
      }
    });
  }
  return callbacks;
}
function getCallbacks ( target , delegate , eventType ) { var callbacks = [ ] ; if ( target . delegateGroup && EVENT_CACHE [ target . delegateGroup ] [ eventType ] ) { _ . each ( EVENT_CACHE [ target . delegateGroup ] [ eventType ] , function ( callbacksList , delegateId ) { if ( _ . isArray ( callbacksList ) && ( delegateId === delegate . delegateId || ( delegate . matchesSelector && delegate . matchesSelector ( delegateId ) ) ) ) { callbacks = callbacks . concat ( callbacksList ) ; } } ) ; } return callbacks ; }
Given a delegate element, an event type, and a test element, test every delegate ID. If it is the same as our test element's delegate ID, or if the test element matches the delegate ID when it is used as a CSS selector, add the callback to the list of callbacks to call.
Given a delegate element an event type and a test element test every delegate ID . If it is the same as our test element s delegate ID or if the test element matches the delegate ID when it is used as a CSS selector add the callback to the list of callbacks to call .