Skip to main content

Bug Tracker

Side navigation

#3453 closed enhancement (invalid)

Opened October 06, 2008 06:49PM UTC

Closed January 31, 2009 04:41PM UTC

append() etc functions to accept many arguments

Reported by: antix Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: multiple arguments, append, prepend, before, after Cc:
Blocked by: Blocking:
Description

for example

var $container = $("<div />");

var $input = $("<input />");

var $okButton = $("<button>Ok</button>");

var $CancelButton = $("<button>Cancel</button>");

$container.append($input, $okButton, $cancelButton);

This way you have references to the content to add events etc and only one call to append()

It would also apply to prepend(), before() and after()

to maintain the ability to change these functions in the future you could let it accept an array

for example

$container.append([$input, $okButton, $cancelButton]);

Attachments (0)
Change History (3)

Changed October 07, 2008 01:55PM UTC by flesler comment:1

component: unfilledcore
need: ReviewPatch
status: newassigned

Changed October 20, 2008 12:29AM UTC by dmethvin comment:2

I'm not clear on what the enhancement is here; you can already pass multiple arguments to append, prepend, etc. by virtue of the code in jQuery.clean that checks for array-like arguments. This has worked for a long time:


$(function(){
   var a = $("<div>hello</div>");
   var b = $("<div>there</div>");
   var c = $("<div>guys</div>");
   $("#test").append(a,b,c);
});

Changed January 31, 2009 04:41PM UTC by dmethvin comment:3

resolution: → invalid
status: assignedclosed

Since this already works as desired I'll close the ticket.