This code also seems very strange to me.  Can't you just add unconditional code to handle touch.enter and touch.leave?   I don't see any need for has('touch') or a hypothetical has flag like has('mouse').