Commit 69212c50 authored by Ariel Flesler's avatar Ariel Flesler

jquery core: closes #2968. Simplified isFunction, dropping support for DOM...

jquery core: closes #2968. Simplified isFunction, dropping support for DOM methods and functions like alert() on IE.
parent 43c4b64f
...@@ -613,9 +613,10 @@ jQuery.extend({ ...@@ -613,9 +613,10 @@ jQuery.extend({
}, },
// See test/unit/core.js for details concerning this function. // 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 ) { isFunction: function( fn ) {
return !!fn && typeof fn != "string" && !fn.nodeName && return fn instanceof Function;
fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
}, },
// check if an element is in a (or is an) XML document // check if an element is in a (or is an) XML document
......
...@@ -107,7 +107,7 @@ test("noConflict", function() { ...@@ -107,7 +107,7 @@ test("noConflict", function() {
}); });
test("isFunction", function() { test("isFunction", function() {
expect(21); expect(19);
// Make sure that false values return false // Make sure that false values return false
ok( !jQuery.isFunction(), "No Value" ); ok( !jQuery.isFunction(), "No Value" );
...@@ -145,7 +145,8 @@ test("isFunction", function() { ...@@ -145,7 +145,8 @@ test("isFunction", function() {
ok( !jQuery.isFunction(obj), "Object Element" ); ok( !jQuery.isFunction(obj), "Object Element" );
// IE says this is an object // 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; var nodes = document.body.childNodes;
...@@ -162,7 +163,8 @@ test("isFunction", function() { ...@@ -162,7 +163,8 @@ test("isFunction", function() {
document.body.appendChild( input ); document.body.appendChild( input );
// IE says this is an object // 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 ); document.body.removeChild( input );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment