Create a gist now

Instantly share code, notes, and snippets.

Polyfill for touch dblclick
@Matthijn

Where is the like button when you need it :)

@philmander
philmander commented Oct 8, 2016 edited

This code is still useful for iOS, but I found that on Chrome 53 for Android, the dblclick event is supported and the polyfill causes dblclicks to run twice. This code:

if (!('ontouchstart' in elem)) {
   // non-touch has native dblclick and no need for polyfill
   return; 
}

...evaluates to false. I'm using this check instead:

if(elem.ondblclick === undefined) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment