add context argument to appendTo() etc.
--- 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);
It's not much more complicated to use
.appendTo($('ul', this))
though.