briangonzalez / jquery.pep.js

👟 Pep, a lightweight plugin for kinetic drag on mobile/desktop
http://pep.briangonzalez.org
1.3k stars 177 forks source link

Added additional property check to guard against simulated touch events #118

Closed damassi closed 10 years ago

damassi commented 10 years ago

This PR adds an additional check to check against the touches property in a native touch event, which may or may not exist if the user is creating or 'triggering' an artificial event. (The example being, when a dev wants to delegate mousedowns and mouseups to touchstart and touchend for sharing events across all platforms.)

briangonzalez commented 10 years ago

Looks good. How was this manifesting itself? Were you seeing errors?

damassi commented 10 years ago

Yup, it was throwing errors whenever I would attempt to drag anything on my desktop, which delegated touch events to mouse via jQuery. I suspect it was some kind of bubbling race condition (which comes first, the touch or the click?) which only manifests itself in certain contexts but this effectively fixed it.

briangonzalez commented 10 years ago

Sounds good, sir. Thanks for the PR!

damassi commented 10 years ago

np :)