Hi John, Indeed that works.
I found out what can be a bug in jQuery 1.3.2. When moving with .append() in Firefox 3.5.5, Opera (9 and 10) and Konqueror 4.3 (tested on both linux and Windows) I get a blank screen if there is a youtube video embedded inside somewhere. Took a while to dig this. On IE8 and Webkit there is no issue. If I use the DOM methods as described earlier, it works fine on Firefox, Opera and KHTML, so this is some issue that happens with jQuery. The embedded code is: --------------------------- 8< -------------------------------- <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"> <object type="application/x-shockwave-flash" data="http://www.youtube-nocookie.com/v/0iZjtav06cc&hl=pt_BR&fs=1&rel=0&color1=0x234900&color2=0x4e9e00&border=1" allowfullscreen="true" allowscriptaccess="always" src="http://www.youtube-nocookie.com/v/0iZjtav06cc&hl=pt_BR&fs=1&rel=0&color1=0x234900&color2=0x4e9e00&border=1" wmode="transparent" movie="http://www.youtube-nocookie.com/v/0iZjtav06cc&hl=pt_BR&fs=1&rel=0&color1=0x234900&color2=0x4e9e00&border=1" height="300" width="502"> </object> </object> --------------------------- >8 -------------------------------- -rsd On Sat, Dec 12, 2009 at 6:09 PM, John Resig <jere...@gmail.com> wrote: > When appending element A to set B the element is moved over in the DOM > into the first element in B. All subsequent elements are cloned > (therefore it's not left in position). > > Also, there's no need to do what you outlined, just do: > $("<div/>").append( $("#old_parent").children() ); > > --John > > > > On Sat, Dec 12, 2009 at 12:11 PM, Raul DIas <rauld...@gmail.com> wrote: >> please, enlight me. >> >> $(A).appendTo(B) will move $(A) to selector B, which in most cases has >> to be an ID or a unique identified element. >> >> For this behaviour, what happens if B specifies multiple elements >> (e.g. class, element selector)? >> >> WIll it clone and copy $(A) ? >> >> If so, the original $(A) will still be in the same parent? >> >> appendTo() should accepts elements and jq objects too as it would be >> more clear (and avoid) the multi-element selector problem. >> >> Here is a behaviour that I would like to replicate in pure jQuery: >> >> 1 - Create an "anonymous" element: >> var divContent = document.createElement("div"); >> or >> var divContent = $("<div/>"); >> >> 2 - move (reparent) the children from '#old_parent' to the new element >> (divContent): >> >> A - Using jQuery + DOM: >> $("#old_parent").children().each( >> function() { >> divContent.appendChild(this); >> } >> ); >> >> B - Using jQuery (or how it would have being) (wont work): >> $("#old_parent").children().appendTo(divContent); >> >> Using a selector is not possible when dealing with anonymous elements. >> >> So, am I missing something? >> >> Can this be considered a bug? >> >> -rsd >> -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.