Opened 13 years ago
Closed 12 years ago
#5704 closed bug (fixed)
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.
Attachments (1)
Change History (3)
Changed 13 years ago by
Attachment: | extendcorrection.txt added |
---|
comment:1 Changed 13 years ago by
Component: | unfilled → core |
---|---|
Summary: | Deep extend fails to copy array → Deep extend converts array to object |
comment:2 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This issue no longer exists
Note: See
TracTickets for help on using
tickets.
$.extend correction