@@ -268,14 +268,19 @@ QUnit.test( "type for `Symbol`", function( assert ) {
268268} ) ;
269269
270270QUnit . asyncTest ( "isPlainObject" , function ( assert ) {
271- assert . expect ( 19 ) ;
271+
272+ assert . expect ( 22 ) ;
272273
273274 var pass , iframe , doc , parentObj , childObj , deep ,
274275 fn = function ( ) { } ;
275276
276277 // The use case that we want to match
277278 assert . ok ( jQuery . isPlainObject ( { } ) , "{}" ) ;
278279 assert . ok ( jQuery . isPlainObject ( new window . Object ( ) ) , "new Object" ) ;
280+ assert . ok ( jQuery . isPlainObject ( { constructor : fn } ) ,
281+ "plain object with constructor property" ) ;
282+ assert . ok ( jQuery . isPlainObject ( { constructor : "foo" } ) ,
283+ "plain object with primitive constructor property" ) ;
279284
280285 parentObj = { foo : "bar" } ;
281286 childObj = Object . create ( parentObj ) ;
@@ -310,6 +315,10 @@ QUnit.asyncTest( "isPlainObject", function( assert ) {
310315 // Again, instantiated objects shouldn't be matched
311316 assert . ok ( ! jQuery . isPlainObject ( new fn ( ) ) , "new fn" ) ;
312317
318+ // Instantiated objects with primitive constructors shouldn't be matched
319+ fn . prototype . constructor = "foo" ;
320+ assert . ok ( ! jQuery . isPlainObject ( new fn ( ) ) , "new fn with primitive constructor" ) ;
321+
313322 // Deep object
314323 deep = { "foo" : { "baz" : true } , "foo2" : document } ;
315324 assert . ok ( jQuery . isPlainObject ( deep ) , "Object with objects is still plain" ) ;
0 commit comments