Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9023 closed bug (invalid)

jQuery.map( { length: 0 } )

Reported by: Robert Katić Owned by:
Priority: low Milestone: 1.next
Component: core Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

IF

{ length: 3, 0: "a", 1: "b", 2: "c" }

is array-like, then there is NO reason why

{ length: 0 }

should not.

Test: http://jsfiddle.net/Aa8vc/

Change History (7)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfiledcore
Priority: undecidedlow
Resolution: invalid
Status: newclosed

Consider the following:

Array-like objects, such as jQuery collections, are treated as arrays. In other words, if an object has a .length property and a value on the .length - 1 index, it is traversed as an array.

From http://api.jquery.com/jquery.map/

Your example does not meet the criteria and therefore is invalid.

comment:2 Changed 12 years ago by Robert Katić

Disagree.

"Array-like objects, such as jQuery collections, are treated as arrays. In other words, if an object has a .length property and a value on the .length - 1 index, it is traversed as an array."

So { length: 0, "-1": "a" } is a an array, but { length: 0 } is not?

Last edited 12 years ago by Robert Katić (previous) (diff)

comment:3 Changed 12 years ago by Rick Waldron

disagree all you want, I was simply quoting the docs.

comment:4 Changed 12 years ago by Robert Katić

So, ipse dixit. That's your argument? Holy Docs.

comment:5 Changed 12 years ago by Robert Katić

Btw. fixing this would also fix #8993, #8995.

Last edited 12 years ago by Robert Katić (previous) (diff)

comment:6 Changed 12 years ago by Robert Katić

Version 1, edited 12 years ago by Robert Katić (previous) (next) (diff)

comment:7 Changed 12 years ago by Timmy Willison

#9025 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.