From a35a7dda343ce5377e8f0e7be38e37f5ae17b378 Mon Sep 17 00:00:00 2001 From: Danny Allen Date: Thu, 15 May 2014 13:35:28 +0100 Subject: * Do not try to jump to line if we can't find a matching target. --- coverage/htmlfiles/coverage_html.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'coverage/htmlfiles/coverage_html.js') 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( $("") .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; } -- cgit v1.2.1