Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12460 closed bug (wontfix)

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

Change History (3)

comment:1 Changed 11 years ago by simonxu

forgive my input errors, i set up a demo page on jsFiddle http://jsfiddle.net/damngoto/ExLbw/

comment:2 Changed 11 years ago by simonxu

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


hope this will help you,:)

comment:3 Changed 11 years ago by mikesherov

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.

Note: See TracTickets for help on using tickets.