var slice = [].slice

exports = function mouseDispatcher(name, fn) {
  return function(x, y) {
    var target = document.elementFromPoint(x, y) || document
    var event = new MouseEvent(name, {
      bubbles: true,
      clientX: x,
      clientY: y
    })
    fn.apply(event, slice.call(arguments, 2))
    target.dispatchEvent(event)
  }
}

var slice = [].slice

exports = function mouseDispatcher(name, fn) {
  return function(clientX, clientY, shiftKey, ctrlKey, altKey, metaKey) {
    var target = document.elementFromPoint(clientX, clientY) || document
    var event = new MouseEvent(name, {
      bubbles: true,
      clientX: clientX,
      clientY: clientY,
      shiftKey: shiftKey,
      ctrlKey: ctrlKey,
      altKey: altKey,
      metaKey: metaKey
    })
    fn.apply(event, slice.call(arguments, 6))
    target.dispatchEvent(event)
  }
}

Handle modifier keys in mouse dispatcher
Handle modifier keys in mouse dispatcher
