Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Polyfill for touch dblclick

Where is the like button when you need it :)

philmander commented Oct 8, 2016

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

...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