makeArray and testing for functionhood

makeArray and testing for functionhood


I'm using jQuery in a site where there is *all* kinds of craziness
going on; I'm developing a "widget" and I don't have a lot of control
over how the author may have dandied up their site.
Anyway, my stuff wasn't working, and I managed to track it down to the
fact that some other JavaScript on the page had decorated Array with a
"call" property. This causes makeArray to blow up, because it assumes
anything with a "call" property must be a function.
Is there a reason that we don't just use "array instanceof Function"
there? (Ditto, "array instanceof String" vs. testing for array.split.)
thanks!
chris
(Pay no attention to the SVN version; it's what's checked into my repo.)
Index: jquery-1.2.6.js
===================================================================
--- jquery-1.2.6.js    (revision 1652)
+++ jquery-1.2.6.js    (working copy)
@@ -1133,7 +1133,7 @@
        if( array != null ){
            var i = array.length;
            //the window, strings and functions also have 'length'
-            if( i == null || array.split || array.setInterval || array.call )
+            if( i == null || array.split || array.setInterval || (array
instanceof Function) )
                ret[0] = array;
            else
                while( i )