This should work
Problem is that double click is still click. So it first triggers click handler than double click. That is why i set timeout of 200ms on click handler.
Double click handler also passes isDoubleClick flag so that handler knows what to do. And in handler based on that and class not existing yet decides which action to do. When click handler gets activated, element already has class and just ignores it.
Could be better, but will fix problem