@@ -286,13 +286,21 @@ QUnit.test( "type for `Symbol`", function( assert ) {
286286} ) ;
287287
288288QUnit . asyncTest ( "isPlainObject" , function ( assert ) {
289- assert . expect ( 15 ) ;
289+ assert . expect ( 19 ) ;
290290
291- var pass , iframe , doc ,
291+ var pass , iframe , doc , parentObj , childObj , deep ,
292292 fn = function ( ) { } ;
293293
294294 // The use case that we want to match
295295 assert . ok ( jQuery . isPlainObject ( { } ) , "{}" ) ;
296+ assert . ok ( jQuery . isPlainObject ( new window . Object ( ) ) , "new Object" ) ;
297+
298+ parentObj = { foo : "bar" } ;
299+ childObj = Object . create ( parentObj ) ;
300+
301+ assert . ok ( ! jQuery . isPlainObject ( childObj ) , "isPlainObject(Object.create({}))" ) ;
302+ childObj . bar = "foo" ;
303+ assert . ok ( ! jQuery . isPlainObject ( childObj ) , "isPlainObject(Object.create({}))" ) ;
296304
297305 // Not objects shouldn't be matched
298306 assert . ok ( ! jQuery . isPlainObject ( "" ) , "string" ) ;
@@ -320,6 +328,10 @@ QUnit.asyncTest( "isPlainObject", function( assert ) {
320328 // Again, instantiated objects shouldn't be matched
321329 assert . ok ( ! jQuery . isPlainObject ( new fn ( ) ) , "new fn" ) ;
322330
331+ // Deep object
332+ deep = { "foo" : { "baz" : true } , "foo2" : document } ;
333+ assert . ok ( jQuery . isPlainObject ( deep ) , "Object with objects is still plain" ) ;
334+
323335 // DOM Element
324336 assert . ok ( ! jQuery . isPlainObject ( document . createElement ( "div" ) ) , "DOM Element" ) ;
325337
0 commit comments