Skip to content
Permalink
Browse files

jquery core: closes #2968. Simplified isFunction, dropping support fo…

…r DOM methods and functions like alert() on IE.
  • Loading branch information
flesler committed Jul 23, 2008
1 parent 43c4b64 commit 69212c501f8875b4650847053cc41eaa470e5848
Showing with 8 additions and 5 deletions.
  1. +3 −2 src/core.js
  2. +5 −3 test/unit/core.js
@@ -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
@@ -107,7 +107,7 @@ test("noConflict", function() {
});

test("isFunction", function() {
expect(21);
expect(19);

// Make sure that false values return false
ok( !jQuery.isFunction(), "No Value" );
@@ -145,7 +145,8 @@ test("isFunction", function() {
ok( !jQuery.isFunction(obj), "Object Element" );

// IE says this is an object
ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );
// Since 1.3, this isn't supported (#2968)
//ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );

var nodes = document.body.childNodes;

@@ -162,7 +163,8 @@ test("isFunction", function() {
document.body.appendChild( input );

// IE says this is an object
ok( jQuery.isFunction(input.focus), "A default function property" );
// Since 1.3, this isn't supported (#2968)
//ok( jQuery.isFunction(input.focus), "A default function property" );

document.body.removeChild( input );

0 comments on commit 69212c5

Please sign in to comment.
You can’t perform that action at this time.