I think this is a bug, I'd expect replaceWith to return the old set, just like append/etc.
Can you (tchvil) file a bug with a test case ? put it under core, assigned to me. Thanks -- Ariel Flesler http://flesler.blogspot.com/ On Sep 17, 8:04 am, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > On Wed, Sep 17, 2008 at 6:58 AM, Karl Rudd <[EMAIL PROTECTED]> wrote: > > > Nah, it's not a bug. > > > replaceWith( content ) Returns: jQuery > > Replaces all matched elements with the specified HTML or DOM elements. > > This returns the JQuery element that was just replaced, which has been > > removed from the DOM > > > (http://docs.jquery.com/Manipulation) > > It may be well documented, but that doesn't mean it can't be a bug. ;) > > > > > It's like doing a remove(), followed by an append(). Like "remove()" > > it also "returns" (well keeps in the jQuery collection) the elements > > it removes. > > This is quite a fundamental difference. Since .remove() returns a DOM > Element, it's not chainable. Since replaceWith() returns a chainable jQuery > object, it's reasonable to expect methods you call on that chain to effect > the new element, not your now removed/disconnected element(s). Like many > other methods, it could modify the chain. And if you wanted to get back to > the previous chain, you could call .end(). My 2c. > > - Richard