docs: function _cleanUpEvents(elem, type) {
    var data = Dom.getElData(elem);
  
    // Remove the events of a particular type if there are none left
    if (data.handlers[type].length === 0) {
      delete data.handlers[type];
      // data.handlers[type] = null;
      // Setting to null was causing an error with data.handlers
  
      // Remove the meta-handler from the element
      if (elem.removeEventListener) {
        elem.removeEventListener(type, data.dispatcher, false);
      } else if (elem.detachEvent) {
        elem.detachEvent('on' + type, data.dispatcher);
      }
    }
  
    // Remove the events object if there are no types left
    if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
      delete data.handlers;
      delete data.dispatcher;
      delete data.disabled;
    }
  
    // Finally remove the element data if there is no data left
    if (Object.getOwnPropertyNames(data).length === 0) {
      Dom.removeElData(elem);
    }
  }