Skip to content
Permalink
Browse files
Added new function-testing code that is completely cross-browser comp…
…atible.
  • Loading branch information
jeresig committed Jan 22, 2007
1 parent e45dbf2 commit b81ea5f9ba19734f0409390bdf2fb685d7498bdc
Showing with 4 additions and 1 deletion.
  1. +4 −1 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 + "" );
},

/**

0 comments on commit b81ea5f

Please sign in to comment.