Lately I've started playing with touch events in javascript and I encountered a strange problem with touchend event (propably something obvious and I'm just too dumb to understand it). So basically, here is my code:
function send(e) {
e.preventDefault();
document.body.innerHTML = e.type + "<br>" + e.targetTouches[0].pageY;
}
['touchstart', 'touchmove', 'touchend'].forEach(function(e) {
window.addEventListener(e, send, false);
});
And now the e.targetTouches[0].pageY works fine, but the e.type will only assume touchstart or touchmove value, not the touchend for some reason. I noticed that it only happens when I try to call the e.type property in the same line or after reading any property from the event.targetTouches (or event.touches) array. Aren't those properties read-only? Why does it brake my code?
Oh, and after few hours of playing with it I noticed that the event.type will assume the touchend value only when holding one finger on the screen and then tapping it with another, still that doesn't solve my problem,.