Bug Tracker

Modify

Ticket #5065 (closed enhancement: wontfix)

Opened 4 years ago

Last modified 3 years ago

add context argument to appendTo() etc.

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

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

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

Change History

Changed 4 years ago by jablko

comment:1 Changed 3 years ago by dmethvin

  • Component changed from unfiled to manipulation

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

comment:2 Changed 3 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 3 years ago by rwaldron

  • Status changed from new to closed
  • Resolution set to wontfix

comment:4 Changed 3 years ago by rwaldron

  • Priority changed from major to low
  • Milestone 1.4 deleted

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.