Skip to main content

Bug Tracker

Side navigation

#5065 closed enhancement (wontfix)

Opened August 17, 2009 08:25PM UTC

Closed November 01, 2010 09:13PM UTC

Last modified November 01, 2010 09:40PM UTC

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 (0.5 KB) - added by jablko August 17, 2009 08:25PM UTC.
Change History (4)

Changed June 13, 2010 04:32PM UTC by dmethvin comment:1

component: unfiledmanipulation

It's not much more complicated to use

.appendTo($('ul', this))
though.

Changed July 15, 2010 10:30AM UTC by ccsakuweb comment:2

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

Changed November 01, 2010 09:13PM UTC by rwaldron comment:3

resolution: → wontfix
status: newclosed

Changed November 01, 2010 09:40PM UTC by rwaldron comment:4

milestone: 1.4
priority: majorlow