diff options
author | Danny Allen <danny.allen@pennantplc.co.uk> | 2014-05-15 13:35:28 +0100 |
---|---|---|
committer | Danny Allen <danny.allen@pennantplc.co.uk> | 2014-05-15 13:35:28 +0100 |
commit | c81183f614ca982cd2ed93ac8e6e76610d162202 (patch) | |
tree | 3012168d22a4a589439687bbce3e64e0ff04d47f /coverage/htmlfiles/coverage_html.js | |
parent | fec2d525b3848888e805ec782c9ade1f193a0add (diff) | |
download | python-coveragepy-git-c81183f614ca982cd2ed93ac8e6e76610d162202.tar.gz |
* Do not try to jump to line if we can't find a matching target.
Diffstat (limited to 'coverage/htmlfiles/coverage_html.js')
-rw-r--r-- | coverage/htmlfiles/coverage_html.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js index 2800dd45..fdee5510 100644 --- a/coverage/htmlfiles/coverage_html.js +++ b/coverage/htmlfiles/coverage_html.js @@ -149,25 +149,27 @@ coverage.wire_up_next_buttons = function () { } } - // Set highlight styling and arrow indicator. - $("p[id^='n'].highlight").removeClass("highlight"); - $("p[id^='n'] span.indicator").remove(); + if (target.length > 0) { + // Set highlight styling and arrow indicator. + $("p[id^='n'].highlight").removeClass("highlight"); + $("p[id^='n'] span.indicator").remove(); - $("p#n" + target.attr("id").match(/\d+/)[0]) - .prepend( + $("p#n" + target.attr("id").match(/\d+/)[0]) + .prepend( $("<span />") .addClass("indicator") .html("◊") ) - .addClass("highlight") + .addClass("highlight"); - // Scroll to line. - $("html, body").animate({ - scrollTop: (target.position().top - ($("#header").outerHeight() + 100)) - }, 100); + // Scroll to line. + $("html, body").animate({ + scrollTop: (target.position().top - ($("#header").outerHeight() + 100)) + }, 100); - // Save target reference in button element for next click. - $(this).data("target", target); + // Save target reference in button element for next click. + $(this).data("target", target); + } return false; } |