[jQuery] Moving DOM elements
> if you re- .appendChild with a node that is already in the
> document, it moves it from it's original location. At least it
> does in non-jQuery code. I'm not sure if jQ's append(),
> etc keep the same behavior
If your jQuery object contains more than one node, the append(), prepend(),
before(), and after() methods clone each argument node before appending it
to each node in the jQuery object. As a result, the original argument nodes
are not removed from their original position in the DOM tree, if they had
one.
It's clear you have to to clone the nodes in the
multiple-jQuery-nodes-selected case, otherwise appending an argument node to
a second jQuery node would remove it from the *first* jQuery node! You could
make an argument for changing the behavior to not clone the node the last
time around so that it would be removed, but that's something to discuss
with John.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/