I've been trying to understand how different pointer events (touch, mouse) are fired in various browsers/on various devices. On that purposed I have written a tiny webpage for testing events http://tstr.29pixels.net.
A few weeks later I've run into Mozilla's event listener test page at http://mozilla.github.io/mozhacks/touch-events/event-listener.html, which produced a very different results (I saw events fired that wasn't showing in my original test tool).
Both websites use different style of binding events, so I'd love to know, where is the difference in binding those events?
For example, pick up your tablet / smartphone with Chrome and try clicking the button on my web. In most cases two events are fired - touchstart and touchend (with occasional touchmove). Then try the Mozilla's tool. There is much more (even including click).
My binding:
$("#button").on('mouseenter mouseleave ... mousemove click', function(e){
...
}
Mozilla binding:
var events = ['MSPointerDown', 'MSPointerUp', ... , 'MSPointerCancel'];
var b = document.getElementById('button');
for (var i=0; i<events.length; i++) {
b.addEventListener(events[i], report, false);
}
These are just the most important parts, full javascript code is written right in the index page of both websites (it's not long).
If anyone could bring some light into this matter for me, I'd be very grateful.