function invokeEventListeners(tuple, eventImpl) {
  const tupleIndex = eventImpl._path.indexOf(tuple);
  for (let i = tupleIndex; i >= 0; i--) {
    const t = eventImpl._path[i];
    if (t.target) {
      eventImpl.target = t.target;
      break;
    }
  }

  eventImpl.relatedTarget = idlUtils.wrapperForImpl(tuple.relatedTarget);

  if (eventImpl._stopPropagationFlag) {
    return;
  }

  eventImpl.currentTarget = idlUtils.wrapperForImpl(tuple.item);

  const listeners = tuple.item._eventListeners;
  innerInvokeEventListeners(eventImpl, listeners);
}