changeset 37831:387af9e5df70 stable

hgweb: prevent triggering dummy href="#" handler Follow up for the previous patch.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 03 May 2018 14:43:25 +0900
parents 82ae4f471254
children 6169d95dce3b
files mercurial/templates/static/mercurial.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/static/mercurial.js	Wed May 02 21:00:43 2018 -0700
+++ b/mercurial/templates/static/mercurial.js	Thu May 03 14:43:25 2018 +0900
@@ -328,14 +328,15 @@
 	}
 }
 
-function toggleDiffstat() {
+function toggleDiffstat(event) {
     var curdetails = document.getElementById('diffstatdetails').style.display;
     var curexpand = curdetails === 'none' ? 'inline' : 'none';
     document.getElementById('diffstatdetails').style.display = curexpand;
     document.getElementById('diffstatexpand').style.display = curdetails;
+    event.preventDefault();
 }
 
-function toggleLinewrap() {
+function toggleLinewrap(event) {
     function getLinewrap() {
         var nodes = document.getElementsByClassName('sourcelines');
         // if there are no such nodes, error is thrown here
@@ -360,6 +361,7 @@
     }
 
     setLinewrap(!getLinewrap());
+    event.preventDefault();
 }
 
 function format(str, replacements) {