jquery core: closes #2968. Simplified isFunction, dropping support for DOM methods and functions like alert() on IE.
This commit is contained in:
parent
43c4b64f32
commit
69212c501f
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in a new issue