• Robert Speicher's avatar
    Prevent a JS error in MergeRequestTabs · fc0d9274
    Robert Speicher authored
    When `window.location.hash` is pointing to a note, e.g. `#note_1234`,
    `scrollToElement` would throw an error because a selector such as
    `.commits #note_1234` doesn't exist, so `offset()` returned `undefined`.
    
    This error would prevent subsequent calls from running, which caused the
    loading spinner to never be hidden.
    
    Now we ensure the selector returns a valid element before trying to
    scroll to it.
    fc0d9274
merge_request_tabs.js.coffee 4.54 KB