benmajor / jQuery-Touch-Events

A collection of mobile event plugins for jQuery.
MIT License
699 stars 225 forks source link

1.0.8 throws an error when using jQuery 3.x.x #128

Closed WeaponX86 closed 7 years ago

WeaponX86 commented 7 years ago

$(document).on('taphold','#test-taphold',function(){ alert('taphold'); });

jquery-3.2.0.min.js:4 Uncaught TypeError: f.getClientRects is not a function at r.fn.init.offset (jquery-3.2.0.min.js:4) at jquery.mobile-events.min.js:27

benmajor commented 7 years ago

Can you confirm if the missing single quote in the alert() statement is a typo here, or is that how it appears in your code?

WeaponX86 commented 7 years ago

That was just a typo in my post. I also tested with 3.0.0 as well and the same error is thrown.

benmajor commented 7 years ago

Okay thanks. I have been able to replicate this with the following: https://jsfiddle.net/pjsamq2z/1/

I'll add it to the fix list!

benmajor commented 7 years ago

The fix for this is not to bind to document, but rather to body:

https://jsfiddle.net/pjsamq2z/2/