Modify ↓
Ticket #2447 (closed bug: worksforme)
$.extend overwrites inner objects nstead of extending
| Reported by: | aercolino | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.4 |
| Component: | core | Version: | 1.2.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
After writing:
var z = $.extend( {a: 1, b: {c: {d: 2}}, f: 5}, {a: 3, b: {c: {e: 4}}} );
I'd expect:
z == {a: 3, b: {c: {d: 2, e: 4}}, f: 5}
But I get:
z == {a: 3, b: {c: {e: 4}}, f: 5}
(Undocumented 'deep' parameter only works for the 1st level)
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

I think the fix could be this (line 599 of jquery-1.2.3.js)
In fact, the 'deep' (true) argument should be propagated to recursion steps.