How about something like "If there is more than a single target (the
element to which X will be appended), the source element(s) will be
cloned, and the original(s) will remain in place. Otherwise the source
element is moved." I don't feel like editing the wiki, my english can
be quite confusing.

- ricardo

On Dec 27, 2:29 pm, "Markus Gritsch" <[email protected]> wrote:
> On Sat, Dec 27, 2008 at 6:40 AM, Dave Methvin <[email protected]> wrote:
>
> > Well, like I said back then, jQuery *must* append clones of the nodes
> > in the case where you are appending to multiple targets.
>
> Agreed.
>
> > That only
> > leaves a question about the one-target-node case. If the default was
> > to append a clone in that situation, it wouldn't be possible to select
> > nodes and move it to a new location in the DOM tree!
>
> IMO it would have been possible by using a 'moveIfSingleTarget'
> boolean-parameter for example or something the like.  This way the
> intended behavior would be seen clearly.
>
> The current danger lies in the silent semantic change depending on the
> target set count.  Currently it is not obvious that one has to put a
> .clone() into the chain to protect the original node from being moved
> if the target set happens to contain just one element, whereas the
> code without the .clone() works perfectly for cases where more than
> one elment matches the selector.
>
> >> At least the current behaviour should be explicitly mentioned in
> >> the API documentation.
>
> > That would be a good idea. Basically all the methods that insert
> > elements documented here are affected:
>
> >http://docs.jquery.com/Manipulation
>
> > So would the best thing to do be to have some single page that
> > describes the behavior, and reference it on that page?
>
> Probably.  This quirk should explicitly be documented, because (at
> least to me) it feels quite strange.
>
> Kind regards,
> Markus

Reply via email to