I am refining my SpriteButton plugin because of some odd behaviors I've seen in our environment. NDA prevents me from saying what our environment is specifically, so I will just say that it is a browser embedded in an application, written by another party so I cannot modify the browser's behavior.
In SpriteButton, I copied code from DragDrop that registers for all three input types (msPointer, mouse and touch) -- the issue is that if multiple types are registered, multiple events are sent to the plugin. For specific example:
On the Android version of the environment, if I tap a button, I get a touch down, touch up, mouse down, mouse up, in that order. Because the mouse up is the last event, and a true mouse up needs to leave the button in a "hover" state, (as the pointer is still over the button) a tap results in a button showing its hover image after the click. Ideally I would only get touch events for a touch and not mouse events, but since I cannot modify the environment, I can only modify what events I register for.
On Windows, IE10+ supports msPointer, so I can just not register for mouse or touch if msPointer is supported, and thus only get one callback issued for one event. iOS doesn't support mouse, so I can just not register for mouse on that platform. Android theoretically supports both.
I can detect Runtime.isAndroid and Runtime.isiOS and not register for mouse events in both cases, but it feels a bit brittle to me. Does anyone know of a more robust way to filter out a mouse event that is a duplicate of a touch event? Obviously I could test the position values, but that isn't 100% reliable. Ideally I'd find something bulletproof.
In the meantime, I will probably just not register for mouse events on iOS and Android, but it does men my plugin could act funny on a system that supports both touch & mouse but not msPointer (such as Chrome under Windows 8, perhaps? I haven't tested, and IE supports msPointer)