git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e45dbf2
)
Added new function-testing code that is completely cross-browser compatible.
author
John Resig
<jeresig@gmail.com>
Mon, 22 Jan 2007 02:17:47 +0000
(
02:17
+0000)
committer
John Resig
<jeresig@gmail.com>
Mon, 22 Jan 2007 02:17:47 +0000
(
02:17
+0000)
src/jquery/jquery.js
patch
|
blob
|
history
diff --git
a/src/jquery/jquery.js
b/src/jquery/jquery.js
index
38c8da3
..
c712b48
100644
(file)
--- 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 + "" );
},
/**