Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#5065 closed enhancement (wontfix)

add context argument to appendTo() etc.

Reported by: jablko Owned by:
Priority: low Milestone:
Component: manipulation Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

--- a/jquery-nightly.js	2009-08-15 13:13:01.000000000 -0700
+++ b/jquery-nightly.js	2009-08-15 13:12:27.000000000 -0700
@@ -2358,8 +2358,8 @@
 	insertAfter: "after",
 	replaceAll: "replaceWith"
 }, function(name, original){
-	jQuery.fn[ name ] = function( selector ) {
-		var ret = [], insert = jQuery( selector );
+	jQuery.fn[ name ] = function( selector, context ) {
+		var ret = [], insert = jQuery( selector, context );
 
 		for ( var i = 0, l = insert.length; i < l; i++ ) {
 			var elems = (i > 0 ? this.clone(true) : this).get();

So far I've wished for this on two occasions,

  • when I wanted to append to elements in another window,
...appendTo('body', selenium.browserbot.getCurrentWindow().document);
  • and when I wanted to append to elements with a selector, but only under this DOM element,
...appendTo('ul', this);

Attachments (1)

patch (537 bytes) - added by jablko 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by jablko

Attachment: patch added

comment:1 Changed 9 years ago by dmethvin

Component: unfiledmanipulation

It's not much more complicated to use .appendTo($('ul', this)) though.

comment:2 Changed 9 years ago by ccsakuweb

You are right, but this works only in Internet Explorer and Firefox. AppendTo into another document does not work in Chrome and Safari.

comment:3 Changed 9 years ago by Rick Waldron

Resolution: wontfix
Status: newclosed

comment:4 Changed 9 years ago by Rick Waldron

Milestone: 1.4
Priority: majorlow
Note: See TracTickets for help on using tickets.