Side navigation
#6675 closed bug (fixed)
Opened June 15, 2010 05:11PM UTC
Closed October 03, 2010 02:05AM UTC
makeArray fails on objects with a length property
Reported by: | 314159abcde | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | core | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Try:
jQuery.makeArray( {'length':5} );
in the firebug console on any jQuery site and it will output [undefined, undefined, undefined, undefined, undefined]
when it should return [Object { length=5}]
This is causing issues where I have an object with a length and width attribute, since it will not pass through makeArray properly.
Attachments (0)
Change History (3)
Changed September 28, 2010 07:22AM UTC by comment:1
Changed September 28, 2010 07:54AM UTC by comment:2
Never mind. I misread your post. Please scratch the previous comment
Changed October 03, 2010 02:05AM UTC by comment:3
priority: | → undecided |
---|---|
resolution: | → fixed |
status: | new → closed |
As Kiyoto has already applied a patch for this to achieve the desired effect, I am updating this ticket to fixed. Please re-submit/re-open if required.
What is the expected behavior here? I changed line 650-652 of src/core.js to
else {
if ( type === "object" ) {
for ( var k in array ) {
push.call( ret, array[k] );
}
} else {
jQuery.merge( ret, array );
}
This will get the desired behavior for your case, but it breaks a slew of jQuery test cases. I was wondering what the expected behavior for jQuery.makeArray({'length':3}) was.