jquery core: closes #2968. Simplified isFunction, dropping support for DOM methods...
authorAriel Flesler <aflesler@gmail.com>
Wed, 23 Jul 2008 16:18:05 +0000 (16:18 +0000)
committerAriel Flesler <aflesler@gmail.com>
Wed, 23 Jul 2008 16:18:05 +0000 (16:18 +0000)
src/core.js
test/unit/core.js

index 7db0a8c..c095f74 100644 (file)
@@ -613,9 +613,10 @@ jQuery.extend({
        },
 
        // See test/unit/core.js for details concerning this function.
+       // Since 1.3 DOM methods and function like alert
+       // aren't supported. They return false on IE (#2968).
        isFunction: function( fn ) {
-               return !!fn && typeof fn != "string" && !fn.nodeName &&
-                       fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
+               return fn instanceof Function;
        },
 
        // check if an element is in a (or is an) XML document
index 71b1246..864f77a 100644 (file)
@@ -107,7 +107,7 @@ test("noConflict", function() {
 });\r
 \r
 test("isFunction", function() {\r
-       expect(21);\r
+       expect(19);\r
 \r
        // Make sure that false values return false\r
        ok( !jQuery.isFunction(), "No Value" );\r
@@ -145,7 +145,8 @@ test("isFunction", function() {
        ok( !jQuery.isFunction(obj), "Object Element" );\r
 \r
        // IE says this is an object\r
-       ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );\r
+       // Since 1.3, this isn't supported (#2968)\r
+       //ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );\r
 \r
        var nodes = document.body.childNodes;\r
 \r
@@ -162,7 +163,8 @@ test("isFunction", function() {
        document.body.appendChild( input );\r
 \r
        // IE says this is an object\r
-       ok( jQuery.isFunction(input.focus), "A default function property" );\r
+       // Since 1.3, this isn't supported (#2968)\r
+       //ok( jQuery.isFunction(input.focus), "A default function property" );\r
 \r
        document.body.removeChild( input );\r
 \r