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 | a35a7dda343ce5377e8f0e7be38e37f5ae17b378 (patch) | |
tree | 2719d330b2cb53c55bf6063c3e6132b30577b4a2 /coverage/htmlfiles/coverage_html.js | |
parent | d163c1028f7c997ca1d9d9e89631a5d5fb58c4c4 (diff) | |
download | python-coveragepy-a35a7dda343ce5377e8f0e7be38e37f5ae17b378.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 2800dd4..fdee551 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; } |