Skip to main content

Bug Tracker

Side navigation

#6646 closed bug (worksforme)

Opened June 08, 2010 08:01AM UTC

Closed March 31, 2011 05:05PM UTC

Incorect rusult from $.isFunction(obj)

Reported by: svcorp77 Owned by:
Priority: low Milestone:
Component: core Version: 1.4.2
Keywords: needsreview Cc:
Blocked by: Blocking:
Description

// jQuery core code:

isFunction: function( obj ) {

return toString.call(obj) === "[object Function]";

},

When initialize flash object (Safari 5) and test it methods:

var flashFunction = $('object', $(iFrame.contentWindow.document))[0].flashFunction

1) typeof flashFunction = function

2) $.isFunction(flashFunction) = false

3) toString.call(flashFunction) = [object cRuntimeMethod]

Attachments (0)
Change History (5)

Changed June 09, 2010 12:39AM UTC by dmethvin comment:1

This is similar to the problem in IE with native "functions" like

window.alert
. I am not sure that particular case is fixable, but if the code isn't fixed we should update the docs so I'll leave this open for now.

Changed July 03, 2010 08:49PM UTC by karunasagark comment:2

Why didn't we try - typeof obj === "function", just wondering??

Changed October 25, 2010 07:28PM UTC by rwaldron comment:3

keywords: isFunction flashneedsreview
milestone: 1.4.3
priority: → low
status: newopen

I don't see this as a major issue - very much edge case, but for the sake of being thorough, something like this would do the trick:

isFunction: function( obj ) {

var signature = toString.call(obj);

return signature === "[object Function]" || signature === "[object cRuntimeMethod]";

}

But this is so far on the edge... "needsreview" to say the least.

Changed November 10, 2010 09:30PM UTC by rwaldron comment:4

Changed March 31, 2011 05:05PM UTC by dmethvin comment:5

resolution: → worksforme
status: openclosed

This browser bug seems to have been fixed. The latest versions of Chrome 10 and Safari 5 return "function" for typeof.