From 602d8f2ce8c91b24d6f16699e0c08f5af0990588 Mon Sep 17 00:00:00 2001 From: "ojan@chromium.org" Date: Fri, 14 Jan 2011 20:30:45 +0000 Subject: [PATCH] 2011-01-14 Ojan Vafai Reviewed by Adam Roben. fix bugs going back and forth between unified and sidebyside https://bugs.webkit.org/show_bug.cgi?id=52470 Now that we're appending DOM nodes directly, we only want to get the first ".text" element in the subtree. In the cases where there are multiple, their contents are the same. Also, when making side-by-side expansion lines, we need to clone the contents so we have a second copy to append to the DOM. * code-review.js: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75809 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Websites/bugs.webkit.org/ChangeLog | 16 ++++++++++++++++ Websites/bugs.webkit.org/code-review.js | 7 ++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Websites/bugs.webkit.org/ChangeLog b/Websites/bugs.webkit.org/ChangeLog index 23e8e8027e45..1be7cb7fccb5 100644 --- a/Websites/bugs.webkit.org/ChangeLog +++ b/Websites/bugs.webkit.org/ChangeLog @@ -1,3 +1,19 @@ +2011-01-14 Ojan Vafai + + Reviewed by Adam Roben. + + fix bugs going back and forth between unified and sidebyside + https://bugs.webkit.org/show_bug.cgi?id=52470 + + Now that we're appending DOM nodes directly, we only want to + get the first ".text" element in the subtree. In the cases + where there are multiple, their contents are the same. + + Also, when making side-by-side expansion lines, we need to + clone the contents so we have a second copy to append to the DOM. + + * code-review.js: + 2011-01-13 Ojan Vafai Reviewed by Adam Barth. diff --git a/Websites/bugs.webkit.org/code-review.js b/Websites/bugs.webkit.org/code-review.js index a8bde40524ac..18775ff95cbd 100644 --- a/Websites/bugs.webkit.org/code-review.js +++ b/Websites/bugs.webkit.org/code-review.js @@ -532,7 +532,8 @@ function sideBySideExpansionLine(line_number, contents) { var line = $('
'); - line.append(lineSide('from', contents, true, line_number)); + // Clone the contents so we have two copies we can put back in the DOM. + line.append(lineSide('from', contents.clone(true), true, line_number)); line.append(lineSide('to', contents, true, line_number)); return line; } @@ -813,7 +814,7 @@ var convert_function = diff_type == 'sidebyside' ? sideBySideifyLine : unifyLine; var from = fromLineNumber(line); var to = toLineNumber(line); - var contents = $('.text', line); + var contents = $('.text', line).first(); var classNames = classNamesForMovingLine(line); var attributes = attributesForMovingLine(line); var id = line.id; @@ -879,7 +880,7 @@ function convertExpansionLine(diff_type, line) { var convert_function = diff_type == 'sidebyside' ? sideBySideExpansionLine : unifiedExpansionLine; - var contents = $('.text', line); + var contents = $('.text', line).first(); var line_number = fromLineNumber(line); var new_line = convert_function(line_number, contents); $(line).replaceWith(new_line); -- 2.36.0