I have a page operation that uses something like:
$(\'#thetable tbody\').replaceWith(newtbody);
in an ajax callback. Sometimes, if the user
Try to use .html() instead of .replaceWith():
$('#thetable tbody').html( newtbody.html() );.
I don't know about possible performance bottlenecks here, but it did the trick for me when I was trying to preserve the scroll position of a div, and it seems to do well with the scroll position of the entire page as well.