reviewboard: work around jquery selector bug (bug 1384558) r=smacleod
authorbyron jones <glob@mozilla.com>
Thu, 27 Jul 2017 00:44:16 +0800
changeset 74 f8309a35ae8e6e99844c03a11df91d5bdb66a7c3
parent 73 86cbd77aa85b6ecbdd9316fe4b3b898aa195b8b0
child 75 f3d30cc0312ed6947f7bd625f5ff75680a5be17a
push id42
push userbjones@mozilla.com
push dateThu, 27 Jul 2017 05:41:05 +0000
reviewerssmacleod
bugs1384558
reviewboard: work around jquery selector bug (bug 1384558) r=smacleod
reviewboard/reviewboard/static/rb/js/pages/views/diffViewerPageView_mozreview.js
reviewboard/reviewboard/static/rb/js/views/issueSummaryTableView.js
--- a/reviewboard/reviewboard/static/rb/js/pages/views/diffViewerPageView_mozreview.js
+++ b/reviewboard/reviewboard/static/rb/js/pages/views/diffViewerPageView_mozreview.js
@@ -374,17 +374,17 @@ RB.DiffViewerPageView = RB.ReviewablePag
 
         this.listenTo(diffReviewableView, 'chunkExpansionChanged', function() {
             /* The selection rectangle may not update -- bug #1353. */
             this._highlightAnchor($(this._$anchors[this._selectedAnchorIndex]));
         });
 
         if (this._startAtAnchorName) {
             /* See if we've loaded the anchor the user wants to start at. */
-            $anchor = $('a[name="' + this._startAtAnchorName + '"]');
+            $anchor = $(document.querySelector('a[name="' + this._startAtAnchorName + '"]'));
 
             /*
              * Some anchors are added by the template (such as those at
              * comment locations), but not all are. If the anchor isn't found,
              * but the URL hash is indicating that we want to start at a
              * location within this file, add the anchor.
              * */
             urlSplit = this._startAtAnchorName.split(',');
--- a/reviewboard/reviewboard/static/rb/js/views/issueSummaryTableView.js
+++ b/reviewboard/reviewboard/static/rb/js/views/issueSummaryTableView.js
@@ -320,17 +320,17 @@ RB.IssueSummaryTableView = Backbone.View
 
     _uncollapseTarget: function() {
         var hash = window.location.hash,
             commentName,
             targetBox;
 
         if (hash.indexOf("comment") > 0) {
             commentName = hash.toString().substring(1);
-            targetBox = $('a[name=' + commentName + ']').closest(".box");
+            targetBox = $(document.querySelector('a[name=' + commentName + ']')).closest(".box");
 
             if (targetBox.hasClass('collapsed')) {
                 targetBox.removeClass('collapsed');
                 // Scroll down to the targeted comment box
                 window.location = window.location;
             }
         }
     },