Modify ↓
Ticket #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: | ||
| 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
Change History
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

