Bug Tracker

Opened 9 years ago

Closed 8 years ago

#6646 closed bug (worksforme)

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]

Change History (5)

comment:1 Changed 9 years ago by dmethvin

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.

comment:2 Changed 9 years ago by karunasagark

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

comment:3 Changed 9 years ago by Rick Waldron

Keywords: needsreview added; isFunction flash removed
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.

comment:6 Changed 8 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.