Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#8516 closed enhancement (wontfix)

Multiple arguments to jQuery.merge

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

I found it strange that jQuery.merge could only handle two arguments resulting in code such as $.merge($.merge([], first), second) which was taken straight out of the documentation.

I am proposing a multiple arguments version of the function, much like $.extend such that the above code can read $.merge([], first, second)

Change History (3)

comment:1 Changed 13 years ago by dmethvin

Resolution: wontfix
Status: newclosed

This isn't needed by core so we're closing it.

comment:2 Changed 12 years ago by sahab.yazdani+jquery@…

Not sure if this is the correct forum for this, but I find the reasoning given for "WONTFIX"ing this bug a little weak. Just because it isn't needed by "core" (whatever that is), doesn't mean it wouldn't be a super-useful utility function for jQuery users. It would certainly serve as a nice bit of sugar on what is there right now and at first blush, doesn't seem like the implementation would add any significant overhead.

Straight from the documentation on merging two arrays into a third one:

var c = $.merge($.merge([], a), b);

Awkward to say the least. It could become:

c = $.merge([], a, b);

So much more legible.

Please re-consider.

comment:3 Changed 12 years ago by Rick Waldron

Feel free to use this handy plugin: http://jsfiddle.net/rwaldron/JfsYx/

Note: See TracTickets for help on using tickets.