Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1905 by Extra whitespace is not highlighted

What version are you running?
ReviewBoard-1.5-py2.6 and up

What's the URL of the page containing the problem?

What steps will reproduce the problem?
1. create review request, upload patch contained some extra whitespace
2. click "View diffs"

What is the expected output? What do you see instead?
ACT: only some of extra whitespaces are highlighted
whitespace in RBBugTracker/ is highlighted
whitespace in RBBugTracker/RBBugTracker/templates/googlecode/save_username.html:7 is not highlighted
EXP: all whitespaces are highlighted

What operating system are you using? What browser?
Chromium 6.0, Firefox 3.6.12, IE 8

Please provide any additional information below.

The bug occurs because toggleExtraWhitespace called in $(document).ready (diffviewer.js:1335) toggleExtraWhitespace function toggles "ewhl" class on all whitespace elements. Since diffs content is loaded asynchronously, most of the whitespace elements are not loaded when document.ready occured.

In my install i fixed it following way:

diff --git a/reviewboard/htdocs/media/rb/js/diffviewer.js b/reviewboard/htdocs/media/rb/js/diffviewer.js
index d283d89..116b016 100644
--- a/reviewboard/htdocs/media/rb/js/diffviewer.js
+++ b/reviewboard/htdocs/media/rb/js/diffviewer.js
@@ -1325,7 +1325,7 @@ function toggleExtraWhitespace(init)

     /* Toggle highlighting */
-    $("table.sidebyside .ew").toggleClass("ewhl");
+    $("#diffs").toggleClass("ewhl");

     /* Toggle the display of the button itself */
     $(".review-request ul.controls li.ew").toggle();
diff --git a/reviewboard/templates/diffviewer/view_diff.html b/reviewboard/templates/diffviewer/view_diff.html
index de1f8c2..62dafc8 100644
--- a/reviewboard/templates/diffviewer/view_diff.html
+++ b/reviewboard/templates/diffviewer/view_diff.html
@@ -23,7 +23,7 @@
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}rb/css/syntax.css?{{MEDIA_SERIAL}}" /> {% if siteconfig.settings.diffviewer_show_trailing_whitespace| default_if_none:1 %}
 <style type="text/css">
-  .ewhl { background: #ee3434; }
+  #diffs.ewhl table.sidebyside .ew { background: #ee3434; }
 {% endif %}
 {% endblock %}

Toggle "ewhl" class only on parent element.
ew elements are highlighted depending on this not their own class.

You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to