diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2017-04-24 12:39:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 12:39:25 -0400 |
commit | a16339b8933f115da3661f3d3f64854c3fa60bdc (patch) | |
tree | e6903c05f9949bab4ca524da7d16ed96c8fb936c /src | |
parent | 1d2df772b4d6e5dbf91df6e75f4a1809f7879ab0 (diff) | |
download | jquery-a16339b8933f115da3661f3d3f64854c3fa60bdc.tar.gz jquery-a16339b8933f115da3661f3d3f64854c3fa60bdc.zip |
Core: Update isFunction to handle unusual-@@toStringTag input
Ref gh-3597
Fixes gh-3600
Fixes gh-3596
Closes gh-3617
Diffstat (limited to 'src')
-rw-r--r-- | src/core.js | 9 |
1 files changed, 7 insertions, 2 deletions
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 <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; } |