function addEventListener(target, type, listener) {
    var onType, prevListener;

    // Modern browsers
    if (target.addEventListener) {
      return target.addEventListener(type, listener, false);
    }

    // Older browsers
    onType = 'on' + type;
    if (target.attachEvent) {
      target.attachEvent(onType, listener);
    } else if (target[onType]) {
      prevListener = target[onType];
      target[onType] = function() {
        listener();
        prevListener();
      };
    } else {
      target[onType] = listener;
    }
  }
/**
   * A cross-browser addEventListener function that adds a listener for the
   * supplied event type to the specified target.
   *
   * @param {object}   target
   * @param {string}   type
   * @param {function} listener
   */
A cross-browser addEventListener function that adds a listener for the
supplied event type to the specified target.


A cross - browser addEventListener function that adds a listener for the supplied event type to the specified target .
function addEventListener(target, type, listener) {
    var onType, prevListener;
    if (target.addEventListener) {
      return target.addEventListener(type, listener, false);
    }
    onType = 'on' + type;
    if (target.attachEvent) {
      target.attachEvent(onType, listener);
    } else if (target[onType]) {
      prevListener = target[onType];
      target[onType] = function() {
        listener();
        prevListener();
      };
    } else {
      target[onType] = listener;
    }
  }
function addEventListener ( target , type , listener ) { var onType , prevListener ; if ( target . addEventListener ) { return target . addEventListener ( type , listener , false ) ; } onType = 'on' + type ; if ( target . attachEvent ) { target . attachEvent ( onType , listener ) ; } else if ( target [ onType ] ) { prevListener = target [ onType ] ; target [ onType ] = function ( ) { listener ( ) ; prevListener ( ) ; } ; } else { target [ onType ] = listener ; } }
A cross-browser addEventListener function that adds a listener for the
 supplied event type to the specified target.
A cross - browser addEventListener function that adds a listener for the supplied event type to the specified target .
// Modern browsers // Older browsers