diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-04 01:44:04 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-05 17:19:01 -0500 |
commit | 3f399fe1817264246f978f542083962319ed0a82 (patch) | |
tree | e9bbc5c85a9ed9c65e3b3101a0998a0c25c70c51 /app | |
parent | c2912b46f8f51567fa7c18c90c493a94c1ffad30 (diff) | |
download | gitlab-ce-3f399fe1817264246f978f542083962319ed0a82.tar.gz |
No need to pass event as a parameter
We should stop passing events as a parameter since we cannot call the method programatically without faking or creating an event even when that event is not entirely required.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/protected_branch_create.js.es6 | 4 | ||||
-rw-r--r-- | app/assets/javascripts/protected_branch_select.js.es6 | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index cc7e422fd89..d3394fae3f9 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -607,7 +607,7 @@ return this.dropdown.before($input); }; - GitLabDropdown.prototype.selectRowAtIndex = function(e, index) { + GitLabDropdown.prototype.selectRowAtIndex = function(index) { var $el, selector; selector = ".dropdown-content li:not(.divider,.dropdown-header,.separator):eq(" + index + ") a"; if (this.dropdown.find(".dropdown-toggle-page").length) { @@ -615,8 +615,6 @@ } $el = $(selector, this.dropdown); if ($el.length) { - e.preventDefault(); - e.stopImmediatePropagation(); return $el.first().trigger('click'); } }; @@ -653,7 +651,7 @@ return false; } if (currentKeyCode === 13 && currentIndex !== -1) { - return _this.selectRowAtIndex(e, $('.is-focused', _this.dropdown).closest('li').index() - 1); + return _this.selectRowAtIndex($('.is-focused', _this.dropdown).closest('li').index() - 1); } }; })(this)); diff --git a/app/assets/javascripts/protected_branch_create.js.es6 b/app/assets/javascripts/protected_branch_create.js.es6 index 44e60e90998..a3115c8d0b5 100644 --- a/app/assets/javascripts/protected_branch_create.js.es6 +++ b/app/assets/javascripts/protected_branch_create.js.es6 @@ -16,7 +16,7 @@ class ProtectedBranchCreate { }); // Select default - $allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(document.createEvent('Event'), 0); + $allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(0); // Allowed to Push dropdowns new ProtectedBranchAccessDropdown({ @@ -26,7 +26,7 @@ class ProtectedBranchCreate { }); // Select default - $allowedToPushDropdown.data('glDropdown').selectRowAtIndex(document.createEvent('Event'), 0); + $allowedToPushDropdown.data('glDropdown').selectRowAtIndex(0); new ProtectedBranchDropdowns({ $dropdowns: this.$wrap.find('.js-protected-branch-select'), diff --git a/app/assets/javascripts/protected_branch_select.js.es6 b/app/assets/javascripts/protected_branch_select.js.es6 index 6ca90453d49..e4881eea222 100644 --- a/app/assets/javascripts/protected_branch_select.js.es6 +++ b/app/assets/javascripts/protected_branch_select.js.es6 @@ -44,9 +44,9 @@ class ProtectedBranchDropdown { this.$protectedBranch.on('click', this.onClickCreateWildcard.bind(this)); } - onClickCreateWildcard(e) { + onClickCreateWildcard() { this.$dropdown.data('glDropdown').remote.execute(); - this.$dropdown.data('glDropdown').selectRowAtIndex(e, 0); + this.$dropdown.data('glDropdown').selectRowAtIndex(0); } getProtectedBranches(term, callback) { |