fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-12-24 07:50 am

[dw-free] Expanding the thread does not update comment-wrapper classes (jQuery beta)

[commit: http://hg.dwscoalition.org/dw-free/rev/84d0dfce4f0b]

http://bugs.dwscoalition.org/show_bug.cgi?id=4050

Remove optimization: it's not compatible with all layouts.

Patch by [personal profile] fu.

Files modified:
  • htdocs/js/jquery.threadexpander.js
--------------------------------------------------------------------------------
diff -r b0e6da563cc6 -r 84d0dfce4f0b htdocs/js/jquery.threadexpander.js
--- a/htdocs/js/jquery.threadexpander.js	Sat Dec 24 14:07:17 2011 +0800
+++ b/htdocs/js/jquery.threadexpander.js	Sat Dec 24 15:50:09 2011 +0800
@@ -110,23 +110,14 @@
     }
 
     if (replies.length > 0) {
-      // get all comments and map them by id.  this seems to be more efficient
-      // in jquery (at least for the results of an ajax request).
-      var newComments = $(".comment", data);
-      var newCommentMap = {};
-      newComments.each(function() {
-          newCommentMap[$(this).attr("id")] = $(this);
-        });
-
-      var cmtIdPrefix = isS1 ? "cmt" : "comment-cmt";
       for (var cmtIdCnt = 0; cmtIdCnt < replies.length; cmtIdCnt++) {
         var cmtId = replies[cmtIdCnt];
         // if we're a valid comment, and either the comment is not expanded
         // or it's the original comment, then it's valid to expand it.
         if (/^\d*$/.test(cmtId) && (talkid == cmtId || (! LJ[cmtId].full))) {
-          var cmtElement = $('#' + cmtIdPrefix + cmtId);
+          var cmtElement = $('#cmt' + cmtId);
           if (cmtElement.length > 0) {
-            var newComment = newCommentMap[cmtIdPrefix + cmtId];
+            var newComment = $("#cmt" + cmtId, data);
             if (newComment) {
               if (isS1) {
                 var oldWidth = getS1SpacerObject(cmtElement).width();
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org