I think you need to check that `targetTouches` is defined before trying to read its `length` property, otherwise you'll get an error on non-touch devices.