Skip to main content

Bug Tracker

Side navigation

#12460 closed bug (wontfix)

Opened September 05, 2012 03:04AM UTC

Closed September 08, 2012 05:11PM UTC

weird behavior on $.makeArray

Reported by: simonxu Owned by:
Priority: low Milestone: None
Component: core Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

my code sample is kind of like this

var source = {
    input : HTMLInputElement, 
    select: HTMLSelectElement, 
    fakeArray : HTMLNodeList 
for(var key in source){
  var arr = $.makeArray(key)
      //do some thing here

the result is buggy, $.makeArray do not turn source[select] into an array contains HTMLSelectElement,but an array contains its options.

while source[select] do not meet this problem ,maybe because it does not own children and does not own length property?

my test is based on chrome 20.0

Attachments (0)
Change History (3)

Changed September 05, 2012 03:13AM UTC by simonxu comment:1

forgive my input errors, i set up a demo page on jsFiddle

Changed September 05, 2012 03:18AM UTC by simonxu comment:2

so my suggestion is if you wanna turn the options into an array, you'd better do it yourself:


hope this will help you,:)

Changed September 08, 2012 05:11PM UTC by mikesherov comment:3

component: unfiledcore
priority: undecidedlow
resolution: → wontfix
status: newclosed

Thanks for contributing!

jQuery.makeArray makes no guarantees about what elements are members of the created array. Sure, the options element are not what you'd expect it to return, but this function is simply a convenience utility method that will return array-likes into arrays and nothing fancier.

With that said, I'm going to resolve this as wontfix.