summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/application.js
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2016-12-28 11:55:22 -0600
committerMike Greiling <mike@pixelcog.com>2016-12-28 11:55:22 -0600
commit49d288499c554cc0fe3f8a957dee3bb7ea7368f7 (patch)
tree5ffd1d47332956f929574786fa1ae24b83e05c6a /app/assets/javascripts/application.js
parent5fe5f33d6ba40ef4f934d60575910f6999534042 (diff)
downloadgitlab-ce-49d288499c554cc0fe3f8a957dee3bb7ea7368f7.tar.gz
limit body click selector to tags with a hash target24876-page-jumps-to-wrong-position-when-clicking-a-comment-anchor
Diffstat (limited to 'app/assets/javascripts/application.js')
-rw-r--r--app/assets/javascripts/application.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 13d5c6e1e0b..e43afbb4cc9 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -90,9 +90,9 @@
Cookies.defaults.path = gon.relative_url_root || '/';
// `hashchange` is not triggered when link target is already in window.location
- $body.on('click', 'a', function() {
+ $body.on('click', 'a[href^="#"]', function() {
var href = this.getAttribute('href');
- if (href && href.indexOf('#') === 0 && href.substr(1) === gl.utils.getLocationHash()) {
+ if (href.substr(1) === gl.utils.getLocationHash()) {
setTimeout(gl.utils.handleLocationHash, 1);
}
});