lib/ev.js
function(el, type, event) {
  if (!el) {
    // emit for ALL elements
    el = document.getElementsByTagName('*');
    var i = el.length;
    while (i--) if (el[i].nodeType === 1) {
      emit(el[i], type, event);
    }
    return;
  }

  event = event || {};
  event.target = event.target || el;
  event.type = event.type || type;

  // simulate bubbling
  while (el) {
    var data = DOM.getData(el, 'events')
      , handle = data && data[type];

    if (handle) {
      event.currentTarget = el;
      var ret = handle.call(el, event);
      if (ret === false || event.cancelBubble) break;
    }

    el = el.parentNode 
      || el.ownerDocument
      || el.defaultView 
      || el.parentWindow;
  }
}
function(el, type, event) {
  if (!el) {
    // emit for ALL elements
    el = document.getElementsByTagName('*');
    var i = el.length;
    while (i--) if (el[i].nodeType === 1) {
      emit(el[i], type, event);
    }
    return;
  }

  event = event || {};
  event.target = event.target || el;
  event.type = event.type || type;

  // simulate bubbling
  while (el) {
    var data = DOM.getData(el, 'events')
      , handle = data && data[type];

    if (handle) {
      event.currentTarget = el;
      var ret = handle.call(el, event);
      if (ret === false || event.cancelBubble) break;
    }

    el = el.parentNode 
      || el.ownerDocument
      || el.defaultView 
      || el.parentWindow;
  }
}
function ( el , type , event ) { if ( ! el ) { // emit for ALL elements el = document . getElementsByTagName ( '*' ) ; var i = el . length ; while ( i -- ) if ( el [ i ] . nodeType === 1 ) { emit ( el [ i ] , type , event ) ; } return ; } event = event || { } ; event . target = event . target || el ; event . type = event . type || type ; // simulate bubbling while ( el ) { var data = DOM . getData ( el , 'events' ) , handle = data && data [ type ] ; if ( handle ) { event . currentTarget = el ; var ret = handle . call ( el , event ) ; if ( ret === false || event . cancelBubble ) break ; } el = el . parentNode || el . ownerDocument || el . defaultView || el . parentWindow ; } }
emit a custom or native event, simulate bubbling
emit a custom or native event simulate bubbling