Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3453 closed enhancement (invalid)

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]);

Change History (3)

comment:1 Changed 11 years ago by flesler

Component: unfilledcore
need: ReviewPatch
Status: newassigned

comment:2 Changed 11 years ago by dmethvin

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);
});

comment:3 Changed 11 years ago by dmethvin

Resolution: invalid
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.