Fixes #958. Declare onTouchStart, onTouchEnd, onTouchMove as function expressions.

This way they get hoisted properly and we don't rely on undefined
behavior (which doesn't work in some browsers).