V.5 ?!
Here is the (hopefully) proper verion :
// GPL (c) 2009 by dbj.org
function isFunction (x) {
switch(typeof x) {
case "function" : return true ;
case "object" :
if ( "function" !== typeof x.toString )
return (x + "").match(/function/) !==
null ;
else
return Object.prototype.toString.call
(x) === "[object Function]" ;
break ;
default : return false ;
}
}
// this was breaking the previous version
window.test = {
toString: function() { return '[function]'; }
};
isFunction( test )
/*
false
*/
isFunction( isFunction )
/*
true
*/
isFunction( confirm )
/*
true
*/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---