Skip to main content

Bug Tracker

Side navigation

#4227 closed bug (worksforme)

Opened February 24, 2009 12:02AM UTC

Closed October 27, 2010 01:23AM UTC

Last modified October 27, 2010 01:23AM UTC

$.extend erratic behavior with objects that have a length property

Reported by: dmethvin Owned by:
Priority: low Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

From the jQuery Google Group:


It seems that it's not safe to use "length" as a nested object

property if I want to use jquery.extend. Is this a know issue?

$.extend(true, {},{"prop":{"length":"-1"}});



Attachments (1)
  • extend_object_with_length.patch (1.7 KB) - added by JDay March 20, 2009 07:22AM UTC.

    Fix and testcase. Use jQuery.isArray() istead of checking for a length property.

Change History (4)

Changed March 21, 2009 05:10PM UTC by dmethvin comment:1

That would only handle true

objects. I think the goal may have been to have
be able to take array-like objects and treat them like Array, e.g., Function.arguments and DOM nodeList. It's worth thinking about so I'll leave the ticket open for further discussion.

Changed April 21, 2009 07:43PM UTC by JDay comment:2

"Array-like" objects can still be handled and should work as before. Where is the value in making a "true" Array out of an object that wasn't an array to begin with?

Changed October 27, 2010 01:23AM UTC by rwaldron comment:3

resolution: → worksforme
status: newclosed

Additional testing:

I don't think there is any misbehaviour here. I'm closing, if the author wants to reopen, then we can do so with valid reason.

Changed October 27, 2010 01:23AM UTC by rwaldron comment:4

priority: minorlow