Side navigation
#2447 closed bug (worksforme)
Opened March 03, 2008 09:22AM UTC
Closed March 10, 2008 04:30AM UTC
$.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: | ||
Blocked by: | Blocking: |
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)
Attachments (0)
Change History (3)
Changed March 03, 2008 07:58PM UTC by comment:1
Changed March 03, 2008 08:17PM UTC by comment:2
OK, I now understand that $.extend works as expected, by overwriting any matching property in the target, so this is not a bug, but a 'true' deep option should not change to 'false' after its first recursion step.
Changed March 10, 2008 04:30AM UTC by comment:3
resolution: | → worksforme |
---|---|
status: | new → closed |
Reported "not a bug" by author.
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.