+2011-01-14 Ojan Vafai <ojan@chromium.org>
+
+ 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 <ojan@chromium.org>
Reviewed by Adam Barth.
function sideBySideExpansionLine(line_number, contents) {
var line = $('<div class="ExpansionLine"></div>');
- 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;
}
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;
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);