diff options
author | John Resig <jeresig@gmail.com> | 2007-01-22 02:17:47 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-01-22 02:17:47 +0000 |
commit | b81ea5f9ba19734f0409390bdf2fb685d7498bdc (patch) | |
tree | 93b2a08aab9af89e0c1be58639933e8cdba8cec0 /src/jquery/jquery.js | |
parent | e45dbf29f88fb965c0abd039a65bc0302dea7e43 (diff) | |
download | jquery-b81ea5f9ba19734f0409390bdf2fb685d7498bdc.tar.gz jquery-b81ea5f9ba19734f0409390bdf2fb685d7498bdc.zip |
Added new function-testing code that is completely cross-browser compatible.
Diffstat (limited to 'src/jquery/jquery.js')
-rw-r--r-- | src/jquery/jquery.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 38c8da303..c712b48e2 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1222,8 +1222,11 @@ jQuery.extend({ $ = jQuery._$; }, + // This may seem like some crazy code, but trust me when I say that this + // is the only cross-browser way to do this. --John isFunction: function( fn ) { - return fn && typeof fn == "function"; + return !!fn && typeof fn != "string" && + typeof fn[0] == "undefined" && /function/i.test( fn + "" ); }, /** |