Opened 13 years ago
Closed 12 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 13 years ago by
comment:3 Changed 12 years ago by
Keywords: | needsreview added; isFunction flash removed |
---|---|
Milestone: | 1.4.3 |
Priority: | → low |
Status: | new → open |
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);
signature === "[object cRuntimeMethod]"; |
}
But this is so far on the edge... "needsreview" to say the least.
comment:6 Changed 12 years ago by
Resolution: | → worksforme |
---|---|
Status: | open → closed |
This browser bug seems to have been fixed. The latest versions of Chrome 10 and Safari 5 return "function" for typeof.
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.