2885: Hide whitespace changes toggle not working in diff viewer

bth****@gmai***** (Google Code) (Is this you? Claim this profile.)
Feb. 4, 2013
What version are you running?

What's the URL of the page containing the problem?
Found on internal instance of ReviewBoard.

What steps will reproduce the problem?
1. View a diff that contains lines with only whitespace changes
2. Try to toggle 'Hide whitespace changes'

What is the expected output? What do you see instead?
References to the whitespace changes should dim and whitespace changes should no longer be highlighted. Instead nothing happens and the button doesn't toggle. 

Chrome's console shows: 
Uncaught Error: Syntax error, unrecognized expression: ol.index a[href=#5.2]

What operating system are you using? What browser?
Windows 7/Mac OS X 10.8 Chrome/Firefox/Opera

Please provide any additional information below.
I've attached a patch that fixes the problem for me.
diff --git a/reviewboard/static/rb/js/diffviewer.js b/reviewboard/static/rb/js/diffviewer.js
index 319b010..e1449a2 100644
--- a/reviewboard/static/rb/js/diffviewer.js
+++ b/reviewboard/static/rb/js/diffviewer.js
@@ -1405,7 +1405,7 @@ function toggleWhitespaceChunks()
     /* Dim the anchor to each chunk in the file list */
     chunks.each(function() {
         var target = this.id.split("chunk")[1];
-        $("ol.index a[href=#" + target + "]").toggleClass("dimmed");
+        $("ol.index a[href='#" + target + "']").toggleClass("dimmed");
     /* Remove chunk identifiers */
#1 david
Can you put this up on http://reviews.reviewboard.org/ ?
#2 bth****@gmai***** (Google Code) (Is this you? Claim this profile.)

#3 david
Fixed in release-1.7.x (85ac059). Thanks!
  • +Fixed