Skip to content

Commit

Permalink
fallback for touch test. should fix any chrome false positives if we …
Browse files Browse the repository at this point in the history
…miss them.
  • Loading branch information
paulirish committed May 21, 2010
1 parent 6640110 commit 0f5939e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,17 @@ window.Modernizr = (function(window,doc,undefined){
* has since been recitifed: http://crbug.com/36415
*/
tests[touch] = function() {
return !!('ontouchstart' in window);

var bool = !!('ontouchstart' in window)

// to be extra safe we'll have a fallback test
bool && doc.addEventListener && doc.addEventListener('mousemove',function mousemove(){
doc.removeEventListener('mousemove',mousemove,false);
Modernizr[touch] = ret[touch] = false;
docElement.className = docElement.className.replace(/\stouch\b/,' no-touch');
},false);

return bool;
};


Expand Down

0 comments on commit 0f5939e

Please sign in to comment.