jQuery had that sort of checks and fairly dumped them in 1.3: http://docs.jquery.com/Release:jQuery_1.3#Changes > .isFunction is simpler now, it no longer handles some strange edge cases (in > favor of simplicity and performance).
By the way, ‘x instanceof Function’ leaks for window and DOM objects in IE. http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak On Aug 3, 7:03 pm, DBJDBJ <dbj...@gmail.com> wrote: > I think we all know that In IE, typeof window.alert , returns “object” > Here is my portable isFunction() , IMHO it might be ine of the > simplest solutions that I have seen? > > // GPL (c) 2009 by DBJ.ORG > var isFunction = typeof (top.alert) == "object" ? > function(x) { > return (x + "").match(/function/) !== null ; > } > : > function (x) { > return x instanceof Function; > } > > // test > isFunction( window.alert ) > // returns true, in all browsers > > Enjoy … > > --DBJ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---