From a16339b8933f115da3661f3d3f64854c3fa60bdc Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 24 Apr 2017 12:39:25 -0400 Subject: Core: Update isFunction to handle unusual-@@toStringTag input Ref gh-3597 Fixes gh-3600 Fixes gh-3596 Closes gh-3617 --- src/core.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core.js b/src/core.js index 54b44b1ea..83d427c78 100644 --- a/src/core.js +++ b/src/core.js @@ -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 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; } -- cgit v1.2.3