Skip to content

Commit

Permalink
Merge pull request #417 from rwldrn/9385
Browse files Browse the repository at this point in the history
Begrudgingly adds chrome detection to jQuery.browser (1.7). Fixes #9385
  • Loading branch information
dmethvin committed Aug 4, 2011
2 parents 566f958 + 09fe3ea commit 5417a2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/core.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var jQuery = function( selector, context ) {
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,


// Useragent RegExp // Useragent RegExp
rchrome = /(chrome)[ \/]([\w.]+)/,
rwebkit = /(webkit)[ \/]([\w.]+)/, rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/, rmsie = /(msie) ([\w.]+)/,
Expand Down Expand Up @@ -828,7 +829,8 @@ jQuery.extend({
uaMatch: function( ua ) { uaMatch: function( ua ) {
ua = ua.toLowerCase(); ua = ua.toLowerCase();


var match = rwebkit.exec( ua ) || var match = rchrome.exec( ua ) ||
rwebkit.exec( ua ) ||
ropera.exec( ua ) || ropera.exec( ua ) ||
rmsie.exec( ua ) || rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
Expand Down
4 changes: 2 additions & 2 deletions test/data/ua.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ mozilla 1.0.1 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.0.1) G
mozilla 1.8.0.10 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.10) Gecko/20070228 Camino/1.0.4 mozilla 1.8.0.10 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.10) Gecko/20070228 Camino/1.0.4
webkit 418.9 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko, Safari) Safari/419.3 Cheshire/1.0.ALPHA webkit 418.9 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko, Safari) Safari/419.3 Cheshire/1.0.ALPHA
webkit 419 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko, Safari/419.3) Cheshire/1.0.ALPHA webkit 419 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko, Safari/419.3) Cheshire/1.0.ALPHA
webkit 525.19 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19 chrome 1.0.154.36 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19
webkit 525.19 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19 chrome 1.0.154.53 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19
mozilla 1.9.0.10 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042815 Firefox/3.0.10 CometBird/3.0.10 mozilla 1.9.0.10 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042815 Firefox/3.0.10 CometBird/3.0.10
mozilla 1.9.0.5 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2009011615 Firefox/3.0.5 CometBird/3.0.5 mozilla 1.9.0.5 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2009011615 Firefox/3.0.5 CometBird/3.0.5
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Crazy Browser 3.0.0 Beta2) msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Crazy Browser 3.0.0 Beta2)
Expand Down

0 comments on commit 5417a2c

Please sign in to comment.