Skip to main content

Bug Tracker

Side navigation

#5750 closed bug (fixed)

Opened January 04, 2010 09:18PM UTC

Closed January 06, 2010 04:11PM UTC

$.extend copies by reference, even with deep=true (patch)

Reported by: fortes Owned by:
Priority: minor Milestone: 1.4
Component: core Version: 1.4a2
Keywords: extend Cc:
Blocked by: Blocking:
Description

a = { arr: [1, 2, 3] }

b = $.extend(true, {}, a)

b.arr.pop()

// Should be false, but is true

a.arr === b.arr

Attachments (1)
Change History (4)

Changed January 04, 2010 09:19PM UTC by fortes comment:1

With real formatting:

a = { arr: [1, 2, 3] }
b = $.extend(true, {}, a)
b.arr.pop()

// Should be false, but is true
a.arr === b.arr

Changed January 05, 2010 05:58AM UTC by fortes comment:3

I shouldn't continue to code on low sleep, but here's a more compact version (ignore the attached patch): http://github.com/fortes/jquery/commit/8c77139415ba86024b545dde326e9fee9b06fb4c

Changed January 06, 2010 04:11PM UTC by john comment:4

resolution: → fixed
status: newclosed