Fix #12199. Handle iteration over inherited properties in oldIE. Close

gh-1196.
This commit is contained in:
Brandon Johnson
2013-04-04 10:14:05 -04:00
committed by Dave Methvin
parent df7847bc25
commit 58b8535d5d
5 changed files with 48 additions and 13 deletions

View File

@@ -453,6 +453,8 @@ jQuery.extend({
},
isPlainObject: function( obj ) {
var key;
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
@@ -472,10 +474,16 @@ jQuery.extend({
return false;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( jQuery.support.ownLast ) {
for ( key in obj ) {
return core_hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );