jquerymobile-swipeupdown icon indicating copy to clipboard operation
jquerymobile-swipeupdown copied to clipboard

Cannot declare property 'touches' of undefined

Open thomstark opened this issue 7 years ago • 1 comments

This line here:

var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event;

Should be more like:

var data = 'originalEvent' in event && 'touches' in event.originalEvent && event.originalEvent.touches ? 
event.originalEvent.touches[0] : ('touches' in event && event.touches ?  event.touches[0] : event);

Otherwise it throws an error when the touches are found in event, rather than originalevent (which isn't always there). It was causing weird results sometimes on swipeup gestures, causing subsequent javascript not to fire. I made the above change and cleared my errors and solved my issue with the subsequent js.

thomstark avatar Jan 20 '18 08:01 thomstark

If you would like to make a PR, I will review and merge.

blackdynamo avatar Feb 12 '18 16:02 blackdynamo