diff options
| author | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 11:20:55 +0530 |
|---|---|---|
| committer | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 11:20:55 +0530 |
| commit | 53af425fea0f2e0c76f155b3e606895c9212325d (patch) | |
| tree | dd21740de024ac61272464b769af23f6f3d6a08e | |
| parent | 317a6cb1e800d25c8e94885364221743dddf4b32 (diff) | |
| download | gitlab-ce-53af425fea0f2e0c76f155b3e606895c9212325d.tar.gz | |
Use plain JS in `goToTodoUrl`, make comment more concise
| -rw-r--r-- | app/assets/javascripts/todos.js.es6 | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6 index bf84d82af97..5b1b585dfac 100644 --- a/app/assets/javascripts/todos.js.es6 +++ b/app/assets/javascripts/todos.js.es6 @@ -146,20 +146,21 @@ } goToTodoUrl(e) { - const todoLink = $(this).data('url'); - let targetLink = $(e.target).attr('href'); + const todoLink = this.dataset.url; + let targetLink = e.target.getAttribute('href'); - if ($(e.target).is('img')) { // See if clicked target was Avatar - targetLink = $(e.target).parent().attr('href'); // Parent of Avatar is link + if (e.target.tagName === 'IMG') { // See if clicked target was Avatar + targetLink = e.target.parentElement.getAttribute('href'); // Parent of Avatar is link } if (!todoLink) { return; } - // Allow Meta-Click (Cmd+Click or Ctrl+Click) - // or Mouse3-click (middle-click) - // to open in a new tab + // 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.preventDefault(); // Meta-Click on username leads to different URL than todoLink. |
