diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2013-03-06 14:42:24 -0500 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2013-03-06 14:42:24 -0500 |
commit | 8d1c42296fefc4e79189b6c2d78a8a78fdd9576d (patch) | |
tree | 7e969982f4510044ad7193bfe80e6f0e536a29df /src | |
parent | 49abe3dc92f4a70c696a47f09f09253d0695043c (diff) | |
download | jquery-8d1c42296fefc4e79189b6c2d78a8a78fdd9576d.tar.gz jquery-8d1c42296fefc4e79189b6c2d78a8a78fdd9576d.zip |
Fixes #13571. jQuery.isPlainObject 1.9.x compatibility
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core.js b/src/core.js index cae3a90e3..39e68c4fc 100644 --- a/src/core.js +++ b/src/core.js @@ -422,8 +422,11 @@ jQuery.extend({ }, isPlainObject: function( obj ) { + var key; // Not plain objects: // - Any object or value whose internal [[Class]] property is not "[object Object]" + // ...Unless it was a constructor, whose prototype property was paved over by + // by a plain object at its declaration. #13571 // - DOM nodes // - window if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { @@ -442,9 +445,11 @@ jQuery.extend({ return false; } - // If the function hasn't returned already, we're confident that - // |obj| is a plain object, created by {} or constructed with new Object - return true; + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { |