Avoid false positives for arguments objects in IE < 9 when using isPlainObject.

Former-commit-id: 19e5a6efed32f26d0c908771eec40e7fb2ecf265
This commit is contained in:
John-David Dalton
2012-08-16 22:22:08 -07:00
parent bfea6bcacf
commit 83d08e3aba

View File

@@ -744,8 +744,9 @@
* @returns {Boolean} Returns `true` if the `value` is a plain `Object` object, else `false`.
*/
function isPlainObject(value) {
// avoid non-objects and false positives for `arguments` objects in IE < 9
var result = false;
if (!(value && typeof value == 'object')) {
if (!(value && typeof value == 'object') || (noArgumentsClass && isArguments(value))) {
return result;
}
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`