Core: Update isFunction to handle unusual-@@toStringTag input

Ref gh-3597
Fixes gh-3600
Fixes gh-3596
Closes gh-3617
This commit is contained in:
Richard Gibson
2017-04-24 12:39:25 -04:00
committed by GitHub
parent 1d2df772b4
commit a16339b893
3 changed files with 107 additions and 10 deletions

View File

@@ -212,7 +212,12 @@ jQuery.extend( {
noop: function() {},
isFunction: function( obj ) {
return jQuery.type( obj ) === "function";
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML <object> elements
// (i.e., `typeof document.createElement( "object" ) === "function"`).
// We don't want to classify *any* DOM node as a function.
return typeof obj === "function" && typeof obj.nodeType !== "number";
},
isWindow: function( obj ) {
@@ -464,7 +469,7 @@ function isArrayLike( obj ) {
var length = !!obj && "length" in obj && obj.length,
type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) {
if ( jQuery.isFunction( obj ) || jQuery.isWindow( obj ) ) {
return false;
}