Skip to content

Commit

Permalink
With the advent of all sorts of different hybrid devices, the touch c…
Browse files Browse the repository at this point in the history
…apability can no longer be guessed from the user agent signature. More robust event bind point based detection is employed instead. #233
  • Loading branch information
pisi committed Oct 6, 2013
1 parent edb83d5 commit b17f796
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
4 changes: 1 addition & 3 deletions jquery.reel.js
Expand Up @@ -2251,8 +2251,6 @@
],
/* Array in a string (comma-separated values) */
array: / *, */,
/* Multi touch devices */
touchy_agent: /iphone|ipod|ipad|android|fennec|rim tablet/i,
/* Lazy (low-CPU mobile devices) */
lazy_agent: /\(iphone|ipod|android|fennec|blackberry/i,
/* Format of frame class flag on the instance */
Expand Down Expand Up @@ -2684,7 +2682,7 @@
// We then only identify the user's browser's capabilities and route around a MSIE's left button
// identification quirk (IE 8- reports left as right).
//
touchy= reel.touchy= (reel.re.touchy_agent).test(client),
touchy= reel.touchy= 'ontouchstart' in window || !!navigator.msMaxTouchPoints,
lazy= reel.lazy= (reel.re.lazy_agent).test(client),

DRAG_BUTTON= touchy ? undefined : (ie && browser_version < 9) ? 1 : 0,
Expand Down
35 changes: 1 addition & 34 deletions test/unit/api.js
Expand Up @@ -179,7 +179,7 @@

ok( typeof $.reel.re == 'object', '`$.reel.re` - regular expressions used by the plugin' );
ok( $.reel.re.image instanceof RegExp, '`$.reel.re.image`' );
ok( $.reel.re.touchy_agent instanceof RegExp, '`$.reel.re.touchy_agent`' );
ok( $.reel.re.touchy_agent === undefined, '`$.reel.re.touchy_agent (removed)`' );
ok( $.reel.re.lazy_agent instanceof RegExp, '`$.reel.re.lazy_agent`' );
ok( $.reel.re.frame_klass instanceof RegExp, '`$.reel.re.frame_klass`' );
ok( $.reel.re.sequence instanceof RegExp, '`$.reel.re.sequence`' );
Expand Down Expand Up @@ -315,39 +315,6 @@
]
}

$.each({
pass: [
'iPhone',
'iPod',
'iPad',
'RIM',
'Generic Android',
'LG',
'HTC',
'ZTE',
'Samsung',
'T-Mobile',
'Fennec'
],
fail: [
'PCs'
]
},
function(result, agent_ids){
$.each(agent_ids, function(ix, group){
test( '`$.reel.re.touchy_agent` '+group+' '+(result? 'qualifies' : 'does NOT qualify')+' as "touchy" device', function(){
var
agent_strings= user_agent[group]

expect(agent_strings.length);

$.each(agent_strings, function(){
ok( $.reel.re.touchy_agent.test(this) == (result == 'pass'), this );
})
});
});
});

$.each({
pass: [
'iPhone',
Expand Down

0 comments on commit b17f796

Please sign in to comment.