Skip to main content

Bug Tracker

Side navigation

#8516 closed enhancement (wontfix)

Opened March 13, 2011 11:35PM UTC

Closed March 30, 2011 05:22PM UTC

Last modified October 06, 2011 07:56PM UTC

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)

Attachments (0)
Change History (3)

Changed March 30, 2011 05:22PM UTC by dmethvin comment:1

resolution: → wontfix
status: newclosed

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

Changed October 06, 2011 07:40PM UTC by sahab.yazdani+jquery@gmail.com comment:2

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.

Changed October 06, 2011 07:56PM UTC by rwaldron comment:3

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