TouchPolyfill
TouchPolyfill copied to clipboard
touchend throws null reference exception
Line 269: if (sourceEvent.type !== 'pointerdown') { oldTouch = touchesWrapper.getTouch(sourceEvent.pointerId); oldTarget = oldTouch.target; sourceEvent.target = oldTarget; }
Should be: if (sourceEvent.type !== 'pointerdown') { oldTouch = touchesWrapper.getTouch(sourceEvent.pointerId); if (oldTouch !== null && oldTouch !== undefined) { oldTarget = oldTouch.target; sourceEvent.target = oldTarget; } }
Hi, do you have an example of where you're having an issue with this?
+1, had the same problem.
+1 having the same issue on Microsoft Edge (WinJS native app).
Also getting undefined
on touch.target
here:
for (i = 0; i < touchesTouchList.length; i++) {
touch = touchesTouchList[i];
if (touch.target.isSameNode(thisTouchTarget)) {
targetTouchesWrapper.addUpdateTouch(touch);
}
}
I found a solution which is to replace:
oldTarget = oldTouch.target;
by the following:
oldTarget = oldTouch ? oldTouch.target : sourceEvent.srcElement;