Browse files

fix the loop and leaked global var.

  • Loading branch information...
1 parent 33b1e30 commit 49219ce0a8bcfa9903df800085c7551f65d61b56 @louisremi committed Aug 20, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 jquery.platform.js
View
6 jquery.platform.js
@@ -2,18 +2,18 @@
var ua = navigator.userAgent.toLowerCase(),
match,
- i = 0
// Useragent RegExp
rplatform = [
/(ip\w+).*?os ([\w_]+)/,
/(android)[ \/]([\w.]+)/,
/(blackberry)(?:\d*?\/|.*?version\/)([\w.]+)/,
/(windows phone)( os)? ([\w.]+)/,
/(symbian)(?:os\/([\w.]+))?/
- ];
+ ],
+ i = rplatform.length;
$.platform = {};
-while ( i++ < rplatfrom.length ) {
+while ( i-- ) {
if ( (match = rplatform[i].exec( ua )) && match[1] ) {
$.platform[ match[1].replace(" p", "P") ] = true;
$.platform.version = match[2].split("_").join(".") || "0";

0 comments on commit 49219ce

Please sign in to comment.