Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mousemove event to be sent on the right target #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion jquery.ui.touch-punch.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@

// Dispatch the simulated event to the target element
event.target.dispatchEvent(simulatedEvent);
var target = event.target;

// Dispatch the simulated event to the target element
if (simulatedType === 'mousemove') {
// Special handling for mouse move: fire on element at the current location instead:
var elementAtPoint = document.elementFromPoint(event.clientX, event.clientY);
if (elementAtPoint !== null) {
target = elementAtPoint;
}
}
target.dispatchEvent(simulatedEvent);
}

/**
Expand Down Expand Up @@ -177,4 +188,4 @@
_mouseDestroy.call(self);
};

})(jQuery);
})(jQuery);