aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-12-17 17:30:38 -0500
committerRick Waldron <waldron.rick@gmail.com>2012-12-26 13:34:37 -0500
commit338eaf6181f4078553dc2453ffe3bd73ab2478eb (patch)
treeef5a335ea03b60c1989ea738f1e7ea483937c92f /src
parent716963937db14e775bf21fd76053a03edc10da49 (diff)
downloadjquery-338eaf6181f4078553dc2453ffe3bd73ab2478eb.tar.gz
jquery-338eaf6181f4078553dc2453ffe3bd73ab2478eb.zip
2.0: Reduce isPlainObject
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/core.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/core.js b/src/core.js
index 3859caa01..96a68c2e6 100644
--- a/src/core.js
+++ b/src/core.js
@@ -417,32 +417,22 @@ jQuery.extend({
},
isPlainObject: function( obj ) {
- // 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
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ // Not plain objects: params that are not [[Class]] "[object Object]", DOM nodes, window
+ if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
+ // Firefox 17+ will throw on host objects. ie window.location
try {
- // Not own constructor property must be Object
if ( obj.constructor &&
- !core_hasOwn.call(obj, "constructor") &&
- !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
return false;
}
} catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
- // 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 );
+ return obj === Object( obj );
},
isEmptyObject: function( obj ) {