Side navigation
#5704 closed bug (fixed)
Opened December 23, 2009 06:00AM UTC
Closed October 25, 2010 09:45PM UTC
Deep extend converts array to object
Reported by: | kbwood | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | core | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If an object already has an attribute that is not an array/object and is deep extended to make that attribute an array, it converts the array into an object. For example:
var x = {y: 1};
$.extend(true, x, {y: [2, 3]});
alert(x.y); // x.y = {0: 2, 1: 3}
To fix, check that the source is already an array/object before trying to use when recursively extending. See line 18 in the attached code extract.