| @@ 515-542 (lines=28) @@ | ||
| 512 | class2type[ toString.call(obj) ] || "object"; |
|
| 513 | }, |
|
| 514 | ||
| 515 | isPlainObject: function( obj ) { |
|
| 516 | // Must be an Object. |
|
| 517 | // Because of IE, we also have to check the presence of the constructor property. |
|
| 518 | // Make sure that DOM nodes and window objects don't pass through, as well |
|
| 519 | if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
|
| 520 | return false; |
|
| 521 | } |
|
| 522 | ||
| 523 | try { |
|
| 524 | // Not own constructor property must be Object |
|
| 525 | if ( obj.constructor && |
|
| 526 | !hasOwn.call(obj, "constructor") && |
|
| 527 | !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
|
| 528 | return false; |
|
| 529 | } |
|
| 530 | } catch ( e ) { |
|
| 531 | // IE8,9 Will throw exceptions on certain host objects #9897 |
|
| 532 | return false; |
|
| 533 | } |
|
| 534 | ||
| 535 | // Own properties are enumerated firstly, so to speed up, |
|
| 536 | // if last one is own, then all properties are own. |
|
| 537 | ||
| 538 | var key; |
|
| 539 | for ( key in obj ) {} |
|
| 540 | ||
| 541 | return key === undefined || hasOwn.call( obj, key ); |
|
| 542 | }, |
|
| 543 | ||
| 544 | isEmptyObject: function( obj ) { |
|
| 545 | for ( var name in obj ) { |
|
| @@ 500-522 (lines=23) @@ | ||
| 497 | class2type[ toString.call(obj) ] || "object"; |
|
| 498 | }, |
|
| 499 | ||
| 500 | isPlainObject: function( obj ) { |
|
| 501 | // Must be an Object. |
|
| 502 | // Because of IE, we also have to check the presence of the constructor property. |
|
| 503 | // Make sure that DOM nodes and window objects don't pass through, as well |
|
| 504 | if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
|
| 505 | return false; |
|
| 506 | } |
|
| 507 | ||
| 508 | // Not own constructor property must be Object |
|
| 509 | if ( obj.constructor && |
|
| 510 | !hasOwn.call(obj, "constructor") && |
|
| 511 | !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
|
| 512 | return false; |
|
| 513 | } |
|
| 514 | ||
| 515 | // Own properties are enumerated firstly, so to speed up, |
|
| 516 | // if last one is own, then all properties are own. |
|
| 517 | ||
| 518 | var key; |
|
| 519 | for ( key in obj ) {} |
|
| 520 | ||
| 521 | return key === undefined || hasOwn.call( obj, key ); |
|
| 522 | }, |
|
| 523 | ||
| 524 | isEmptyObject: function( obj ) { |
|
| 525 | for ( var name in obj ) { |
|