summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2017-02-07 11:22:52 +0530
committerKushal Pandya <kushal@gitlab.com>2017-02-07 21:12:01 +0530
commitef99b5e8969c939fce576a6d25c6b8dd4ce54f5f (patch)
treeedb9e7f46b71911edeee4ffb69486dc00d263726
parentf9c23de6de28eaf3a90877a3db9ddd0c5f634b0c (diff)
downloadgitlab-ce-ef99b5e8969c939fce576a6d25c6b8dd4ce54f5f.tar.gz
Use plain JS within `clickTab`, make comment more concise
-rw-r--r--app/assets/javascripts/merge_request_tabs.js.es614
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6
index 10c4fdf1f4f..43ba94ada9b 100644
--- a/app/assets/javascripts/merge_request_tabs.js.es6
+++ b/app/assets/javascripts/merge_request_tabs.js.es6
@@ -102,10 +102,16 @@ require('./flash');
}
clickTab(e) {
- const targetLink = $(e.target).attr('href');
- if (e.metaKey || e.ctrlKey || e.which === 2) {
- e.stopImmediatePropagation();
- window.open(targetLink, '_blank');
+ if (e.target) {
+ const targetLink = e.target.getAttribute('href');
+ // Allow following special clicks to make link open in new tab
+ // 1) Cmd + Click on Mac (e.metaKey)
+ // 2) Ctrl + Click on PC (e.ctrlKey)
+ // 3) Middle-click or Mouse Wheel Click (e.which is 2)
+ if (e.metaKey || e.ctrlKey || e.which === 2) {
+ e.stopImmediatePropagation();
+ window.open(targetLink, '_blank');
+ }
}
}