On mobile safari with live("tap"), tap event fires twice. And this causes kinds of bugs such as opening dialog twice, sending ajax request twice, etc... The most notable one is, when you tap a text field, safari sometimes focuses nowhere.
The following is a minimum code that reproduces it.
After loading this page, tap just above/below the text field (not inside it). Normally this focuses on the textfield because safari mobile has some margin around textfield for usability. But in this case after keyboard slides up, focus is not on the text field and tapping keyboard prints no text on it, even Done button doesn't work.
At this point, focus is actually on BODY tag. You can see it by alert(document.activeElement). My guess is that this is caused by the doubly fired tap events. On the first tap event, focus is on the textfield and safari start preparing keyboard slides up. But on the second tap event, focus is moved to body tag (i don't know why but should be related to the margin around textfield) and when the keyboard is ready it works oddly.
The reason why tap fires twice is, in the definition of $.event.special.tap, event handler is bound to both mouseXXX and touchYYY like
and each handler fires tap event. I think this should be the following.
I had the same problem by using .bind('tap',...) on an image. After reading the "fast buttons" link above I just did a quick and dirty trick by storing the last clicked coordinates in an data attribute in the image-tag. If the same coordinates as the last click gets fired again, i simply ignore it. The chance that exactly the same coords are getting fired again by a users click is very low.
//prevent same event from firing twice
var lastclickpoint = $(this).attr('data-clickpoint');
var curclickpoint = event.clientX+'x'+event.clientY
if (lastclickpoint == curclickpoint) return false;
I found that I had to remove line 12 to protect against multiple-tap hell. Found I was still getting double-taps sometimes but now rarely. Thinking of doing the same thing but using a time delay instead of coordinate.
//Edit Think the reason I was still getting double-taps is because they weren't double taps but were indeed 8-taps!