target[ name ] = jQuery.extend( deep, src, copy );
// Don't bring in undefined values
- else if ( copy != undefined )
+ else if ( copy !== undefined )
target[ name ] = copy;
}
});\r
\r
test("$.extend(Object, Object)", function() {\r
- expect(17);\r
+ expect(20);\r
\r
var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },\r
options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },\r
isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );\r
isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );\r
equals( deep1.foo2, document, "Make sure that a deep clone was not attempted on the document" );\r
-\r
+ \r
+ var nullUndef;\r
+ nullUndef = jQuery.extend({}, options, { xnumber2: null });\r
+ ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied");\r
+ \r
+ nullUndef = jQuery.extend({}, options, { xnumber2: undefined });\r
+ ok( nullUndef.xnumber2 === options.xnumber2, "Check to make sure undefined values are not copied");\r
+ \r
+ nullUndef = jQuery.extend({}, options, { xnumber0: null });\r
+ ok( nullUndef.xnumber0 === null, "Check to make sure null values are inserted");\r
+ \r
var target = {};\r
var recursive = { foo:target, bar:5 };\r
jQuery.extend(true, target, recursive);\r