diff options
| author | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 11:22:52 +0530 |
|---|---|---|
| committer | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 11:32:23 +0530 |
| commit | 44ac376f6611eb51ac31252bd6baf92d544501cb (patch) | |
| tree | fe941b3851fb1187e1b5f11d56f112536dd5f67c | |
| parent | 53af425fea0f2e0c76f155b3e606895c9212325d (diff) | |
| download | gitlab-ce-44ac376f6611eb51ac31252bd6baf92d544501cb.tar.gz | |
Use plain JS within `clickTab`, make comment more concise
| -rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.es6 | 14 |
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'); + } } } |
