[jQuery] Re: .replaceWith Issue

2009-08-19 Thread Matthew Wehrle
Brilliant! Thanks very much. :D

[jQuery] Re: .replaceWith Issue

2009-08-18 Thread Ricardo
IE doesn't handle custom elements well, make them all divs or spans and it should be fine. Or if you need to keep it that way, try putting this before all scripts: if( $.browser.msie ){ $.each('Name,Role,Interests,Words'.split(','), function(){ document.createElement(this); }); };

[jQuery] Re: replaceWith()

2009-08-05 Thread Charlie
there are lots of ways in jQuery to create relationships between selectors depending on your markup. Without seeing any markup it's hard for anyone else to help you create those connections ProfCrazyHorse wrote: I want to replace one element with another, and keep the element contents

[jQuery] Re: replaceWith()

2009-08-05 Thread Cesar Sanz
@ProfCrazyHorse: Your solution seems simple.. why to change something that is working fine? - Original Message - From: Charlie To: jquery-en@googlegroups.com Sent: Wednesday, August 05, 2009 6:38 AM Subject: [jQuery] Re: replaceWith() there are lots of ways in jQuery

[jQuery] Re: replaceWith()

2009-08-05 Thread mkmanning
-   From: Charlie   To: jquery-en@googlegroups.com   Sent: Wednesday, August 05, 2009 6:38 AM   Subject: [jQuery] Re: replaceWith()   there are lots of ways in jQuery to create relationships between selectors depending on your markup. Without seeing any markup it's hard for anyone else to help

[jQuery] Re: replaceWith()

2009-08-05 Thread ProfCrazyHorse
something that is working fine?   - Original Message -   From: Charlie   To: jquery-en@googlegroups.com   Sent: Wednesday, August 05, 2009 6:38 AM   Subject: [jQuery] Re: replaceWith()   there are lots of ways in jQuery to create relationships between selectors depending on your

[jQuery] Re: replaceWith returns the replaced element

2008-09-21 Thread tchvil
Richard, Thanks for your reply. It is neat but it leaks memory on IE. While the following not: $.fn.replaceWithAndReturnNew = function(html){ var div = document.createElement('div'); var replaced = this[0];

[jQuery] Re: replaceWith returns the replaced element

2008-09-20 Thread tchvil
Thanks a lot for your replies. Ok, I guess there are good reasons to return the replaced object. Now my question becomes... is there a better jQuery way of doing this quite ugly thing: $.fn.replaceWithAndReturnNew = function(htmls){ var replaced = $(this)[0]; var div =

[jQuery] Re: replaceWith returns the replaced element

2008-09-20 Thread Richard D. Worth
$.fn.replaceWithAndReturnNew = function(htmls){ var replacer = $(htmls); $(this).replaceWith(replacer); return replacer; }; - Richard On Sat, Sep 20, 2008 at 3:31 AM, tchvil [EMAIL PROTECTED] wrote: Thanks a lot for your replies. Ok, I guess there are good reasons to return the

[jQuery] Re: replaceWith returns the replaced element

2008-09-20 Thread tchvil
This one is slightly better altough not in jQuery style: $.fn.replaceWithAndReturnNew = function(html){ var elm = $(this)[0].cloneNode(false); $(this).after(elm).remove(); elm.innerHTML = html; return $(elm);}; On Sep 20, 9:31 am, tchvil [EMAIL PROTECTED] wrote:

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Richard D. Worth
This sounds like a bug to me. Better raise it on the jQuery Dev list: http://groups.google.com/group/jquery-dev/ - Richard On Tue, Sep 16, 2008 at 4:58 AM, tchvil [EMAIL PROTECTED] wrote: Hi, replaceWith returns the JQuery element that was just replaced. In the example below: $(

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Karl Rudd
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's like doing a remove(),

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Richard D. Worth
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

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Karl Rudd
Err remove() is chainable. It doesn't return a DOM element, it keeps hold of the elements that it was called to remove from the DOM. So it acts just like replaceWith(). There was a debate in the early stages of jQuery about whether or not methods (not including the base $/jQuery function) that

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Ariel Flesler
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

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Ariel Flesler
Sorry, I missunderstood the initial (and subsequential) posts. The present behavior (return the initially matched element) is the correct one. That's what I'd expect and it matches the behavior of remove(), append(), etc. Don't file any bug report :) Thanks Richard for pinging me about this.

[jQuery] Re: replaceWith returns the replaced element

2008-09-17 Thread Richard D. Worth
On Wed, Sep 17, 2008 at 4:58 PM, Karl Rudd [EMAIL PROTECTED] wrote: Err remove() is chainable. It doesn't return a DOM element, it keeps hold of the elements that it was called to remove from the DOM. So it acts just like replaceWith(). There was a debate in the early stages of jQuery about

[jQuery] Re: replaceWith -- Use with Classes

2008-01-25 Thread vanoosterhout
Thanks Karl, Perfect. Worked like charm. Christopher On Jan 25, 2:03 pm, Karl Swedberg [EMAIL PROTECTED] wrote: I can't build the whole thing for you because I don't know what is   being clicked and which element's class you want changed, but in   general you can manipulate classes with

[jQuery] Re: replaceWith -- Use with Classes

2008-01-25 Thread Karl Swedberg
I can't build the whole thing for you because I don't know what is being clicked and which element's class you want changed, but in general you can manipulate classes with .addClass('some-class') and .removeClass('optional-class-name') and .toggleClass('some-class'). You'll find these

[jQuery] Re: .replaceWith() broken in Firefox 2 I think

2007-09-24 Thread Steve Finkelstein
This is actually happening in IE7 also. Is it possible that something is hosed with my code? I'm more confident it's that than a broken replaceWith() but I'd really like to know why it only works once, and then I need a page refresh for that ajax effect. - sf On 9/24/07, Steve Finkelstein

[jQuery] Re: .replaceWith() broken in Firefox 2 I think

2007-09-24 Thread John Resig
Are you meaning to do .html(..) instead of replaceWith? replaceWith completely removes the element (which means that when it's called the second time, nothing happens, since the element no longer exists). Whereas .html() simply replaces the contents of the element. --John On 9/24/07, Steve

[jQuery] Re: .replaceWith() broken in Firefox 2 I think

2007-09-24 Thread Steve Finkelstein
John, Well figures .. it is my code. .html() certainly does the trick. I wasn't aware that replaceWith removes stuff from the DOM indefinitely. A, thanks for saving me from hours of troubleshooting. I really really appreciate it. - sf On 9/24/07, John Resig [EMAIL PROTECTED] wrote: Are