Skip to content

Commit

Permalink
Fix jQuery 3 deprecations
Browse files Browse the repository at this point in the history
`focus` and `delegate` have been deprecated respectively in jQuery 3.3.0
and 3.0.0

This commit replaces `focus` with `trigger` (available since v1.0.0) and
`delegate` with `on` (available since v1.7.0)

Ref:
- https://api.jquery.com/category/deprecated/deprecated-3.0/
- jquery/api.jquery.com#972
  • Loading branch information
timokae authored and tagliala committed May 1, 2021
1 parent 5537c8b commit e2317e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vendor/assets/javascripts/data-confirm-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
});

modal.on('shown.bs.modal', function () {
verification.focus();
verification.trigger('focus');
});

modal.on('hidden.bs.modal', function () {
Expand All @@ -274,7 +274,7 @@
focus_element = modal.find('.' + focus_element);

modal.on('shown.bs.modal', function () {
focus_element.focus();
focus_element.trigger('focus');
});

$('body').append(modal);
Expand Down Expand Up @@ -330,7 +330,7 @@
*/
var window_confirm = window.confirm;

$(document).delegate(settings.elements.join(', '), 'confirm', function() {
$(document).on('confirm', settings.elements.join(', '), function() {
var modal = $(this).getConfirmModal();

if (!modal.is(':visible')) {
Expand Down

0 comments on commit e2317e7

Please sign in to comment.