Improve touch detection logic so that unit tests can be run under phantomjs

Phantomjs is uncorrectly detected as touch-enabled, see https://github.com/ariya/phantomjs/issues/10375.
This way SC unit tests can be run under phantomjs, allowing easy travis-ci integration.

Tested on FF,Chrome and Phantomjs.