//https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Events/Creating_and_triggering_events
function triggerMouseup(elem) {
  var event = new MouseEvent('mouseup', {
    'view': window,
    'bubbles': true,
    'cancelable': true
  });
  (elem || document.body).dispatchEvent(event);
}
function triggerMouseup(elem) {
  fireEvent((elem || document.body), 'mouseup')
}

//http://stackoverflow.com/questions/827716/emulate-clicking-a-link-with-javascript-that-works-with-ie
function fireEvent(obj, evt) {
  var fireOnThis = obj;
  if (document.createEvent) {
    var evObj = document.createEvent(evt.indexOf('mouse') > -1 ? 'MouseEvents' : 'KeyboardEvent');
    evObj.initEvent(evt, true, false);
    fireOnThis.dispatchEvent(evObj);

  } else if (document.createEventObject) {
    var evObj = document.createEventObject();
    fireOnThis.fireEvent('on' + evt, evObj);
  }
}
fix most tests in IE11 (29/32 pass now)