I'm just throwing this out here -- haven't tested this for performance and this may be way off base for what you need. So here goes nothing.
What if you: 1. Created a hidden div on the page (style="display:none") 2. Have the ajax call return updates as html, with the changes having a new class, such as "changed". 3. Appended the new updates to the div: div.html(ajaxResults); 4. Iterate through the changes like this: div.find('.changed').each(function(i){update_element(this);}); What do you think? JK -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of koollx Sent: Monday, October 15, 2007 9:29 AM To: jQuery (English) Subject: [jQuery] Re: Extremely poor performance of jQuery on AJAX partial page updates Thanks for your suggestion. I think it may help but it won't completely solve the problem. Let me give a little background on what I'm actually trying to do. In response to an Ajax call the server returns an array of component updates that need to be applied to the page. Updates include DELETE, INSERT, UPDATE. Delete is easy, insert and update is where the performance is bad. For each component the server provides component id in DOM, it's parent id and the HTML markup, which can include nested <SCRIPT> elements. I've posted my algorithm below: http://pastemonkey.org/paste/47137e93-0d2c-4e13-b8c7-263e404fdb0d Your suggestion may help me with UPDATE - I can do something like $(state.componentId).html(state.html) Calling .html() function on a parent would empty it which is wrong - there may be an update for 1 child out of 3. But how would I do the INSERT? Should I just use DOM's createElement() and appendChild() directly? Or use innerHTML? And would it execute <SCRIPT> elements? In general, does anybody know why jQuery has that regexp in the constructor - I assume there is a good reason why they are doing it.