aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2016-03-03 18:29:45 -0500
committerTimmy Willison <timmywillisn@gmail.com>2016-03-07 11:12:47 -0500
commit00575d4d8c7421c5119f181009374ff2e7736127 (patch)
treeb924784bd86cd12730b56eeaa6cdcaa2d1305ed0 /src
parentbb235ed3b4003e1a36bafddf007e24d3e03a80a6 (diff)
downloadjquery-00575d4d8c7421c5119f181009374ff2e7736127.tar.gz
jquery-00575d4d8c7421c5119f181009374ff2e7736127.zip
Core: restore enumeration behavior in isPlainObject
Fixes gh-2968 Close gh-2970
Diffstat (limited to 'src')
-rw-r--r--src/core.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core.js b/src/core.js
index b10128c7a..17673dfac 100644
--- a/src/core.js
+++ b/src/core.js
@@ -225,6 +225,7 @@ jQuery.extend( {
},
isPlainObject: function( obj ) {
+ var key;
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
@@ -239,9 +240,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 || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {