vendor/videojs/video.js
function trigger(elem, event, hash) {
  // Fetches element data and a reference to the parent (for bubbling).
  // Don't want to add a data object to cache for every parent,
  // so checking hasElData first.
  var elemData = Dom.hasElData(elem) ? Dom.getElData(elem) : {};
  var parent = elem.parentNode || elem.ownerDocument;
  // type = event.type || event,
  // handler;

  // If an event name was passed as a string, creates an event out of it
  if (typeof event === 'string') {
    event = { type: event, target: elem };
  }
  // Normalizes the event properties.
  event = fixEvent(event);

  // If the passed element has a dispatcher, executes the established handlers.
  if (elemData.dispatcher) {
    elemData.dispatcher.call(elem, event, hash);
  }

  // Unless explicitly stopped or the event does not bubble (e.g. media events)
  // recursively calls this function to bubble the event up the DOM.
  if (parent && !event.isPropagationStopped() && event.bubbles === true) {
    trigger.call(null, parent, event, hash);

    // If at the top of the DOM, triggers the default action unless disabled.
  } else if (!parent && !event.defaultPrevented) {
    var targetData = Dom.getElData(event.target);

    // Checks if the target has a default action for this event.
    if (event.target[event.type]) {
      // Temporarily disables event dispatching on the target as we have already executed the handler.
      targetData.disabled = true;
      // Executes the default action.
      if (typeof event.target[event.type] === 'function') {
        event.target[event.type]();
      }
      // Re-enables event dispatching.
      targetData.disabled = false;
    }
  }

  // Inform the triggerer if the default was prevented by returning false
  return !event.defaultPrevented;
}
function trigger(elem, event, hash) {
  // Fetches element data and a reference to the parent (for bubbling).
  // Don't want to add a data object to cache for every parent,
  // so checking hasElData first.
  var elemData = Dom.hasElData(elem) ? Dom.getElData(elem) : {};
  var parent = elem.parentNode || elem.ownerDocument;
  // type = event.type || event,
  // handler;

  // If an event name was passed as a string, creates an event out of it
  if (typeof event === 'string') {
    event = { type: event, target: elem };
  }
  // Normalizes the event properties.
  event = fixEvent(event);

  // If the passed element has a dispatcher, executes the established handlers.
  if (elemData.dispatcher) {
    elemData.dispatcher.call(elem, event, hash);
  }

  // Unless explicitly stopped or the event does not bubble (e.g. media events)
  // recursively calls this function to bubble the event up the DOM.
  if (parent && !event.isPropagationStopped() && event.bubbles === true) {
    trigger.call(null, parent, event, hash);

    // If at the top of the DOM, triggers the default action unless disabled.
  } else if (!parent && !event.defaultPrevented) {
    var targetData = Dom.getElData(event.target);

    // Checks if the target has a default action for this event.
    if (event.target[event.type]) {
      // Temporarily disables event dispatching on the target as we have already executed the handler.
      targetData.disabled = true;
      // Executes the default action.
      if (typeof event.target[event.type] === 'function') {
        event.target[event.type]();
      }
      // Re-enables event dispatching.
      targetData.disabled = false;
    }
  }

  // Inform the triggerer if the default was prevented by returning false
  return !event.defaultPrevented;
}
function trigger ( elem , event , hash ) { // Fetches element data and a reference to the parent (for bubbling). // Don't want to add a data object to cache for every parent, // so checking hasElData first. var elemData = Dom . hasElData ( elem ) ? Dom . getElData ( elem ) : { } ; var parent = elem . parentNode || elem . ownerDocument ; // type = event.type || event, // handler; // If an event name was passed as a string, creates an event out of it if ( typeof event === 'string' ) { event = { type : event , target : elem } ; } // Normalizes the event properties. event = fixEvent ( event ) ; // If the passed element has a dispatcher, executes the established handlers. if ( elemData . dispatcher ) { elemData . dispatcher . call ( elem , event , hash ) ; } // Unless explicitly stopped or the event does not bubble (e.g. media events) // recursively calls this function to bubble the event up the DOM. if ( parent && ! event . isPropagationStopped ( ) && event . bubbles === true ) { trigger . call ( null , parent , event , hash ) ; // If at the top of the DOM, triggers the default action unless disabled. } else if ( ! parent && ! event . defaultPrevented ) { var targetData = Dom . getElData ( event . target ) ; // Checks if the target has a default action for this event. if ( event . target [ event . type ] ) { // Temporarily disables event dispatching on the target as we have already executed the handler. targetData . disabled = true ; // Executes the default action. if ( typeof event . target [ event . type ] === 'function' ) { event . target [ event . type ] ( ) ; } // Re-enables event dispatching. targetData . disabled = false ; } } // Inform the triggerer if the default was prevented by returning false return ! event . defaultPrevented ; }
Trigger an event for an element

@param  {Element|Object}      elem  Element to trigger an event on
@param  {Event|Object|String} event A string (the type) or an event object with a type attribute
@param  {Object} [hash] data hash to pass along with the event
@return {Boolean=} Returned only if default was prevented
@method trigger
Trigger an event for an element