bitovi / jquerypp

jQuery's missing utils and special events
http://jquerypp.com
MIT License
1.21k stars 160 forks source link

Fix issue with dropon event not working on touch devices #106

Closed jondubois closed 9 years ago

jondubois commented 10 years ago

My fix is inspired by this one here: https://github.com/whatisjasongoldstein/jquerypp/commit/1e04f542683c3b2ea7186abe3301dd7a47bdc921 That fix introduced redundancies and didn't solve the problem cleanly, so I improved it.

From what I understood, the bug was that the previous code would not make use of originalEvent.changedTouches[0] if originalEvent.touches was empty - Which is incorrect behavior in the case of a dropon event.

In reality, it is possible to have an empty originalEvent.touches array, and yet have some originalEvent.changedTouches (I.e. Immediately after the finger is lifted from the touchscreen).