Skip to main content

Bug Tracker

Side navigation

#1907 closed bug (fixed)

Opened November 09, 2007 02:28PM UTC

Closed November 17, 2007 04:30AM UTC

Last modified March 15, 2012 12:35AM UTC

jQuery.extend() deep destroys array of zero

Reported by: genezys Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:
jQuery.extend(true, {plop:[]}, {plop:[0]}) 

returns an object where plop is an empty array.

Attachments (0)
Change History (2)

Changed November 09, 2007 08:24PM UTC by davidserduke comment:1

It appears this is a coersion problem. In jQuery.extend there is a section

// Prevent never-ending loop
if ( target == prop[i] )

Coersion says that [] is false and 0 is false. So they are equal. This test should probably use === instead.

Changed November 17, 2007 04:30AM UTC by davidserduke comment:2

resolution: → fixed
status: newclosed

Fixed in [3841].

Note, the code treats all objects the same with no special handling for Arrays at this point.