From 6918015508c71da9a45ffec4ed41147fbe1dfa1f Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Tue, 11 Apr 2023 22:31:02 +0530 Subject: [PATCH] Fix deprecated use of 'jQuery.fn.change()' shorthand event This patch changed the code to use the recommended 'on()' method instead of the deprecated shorthand event. For more information about this deprecation, please refer [1]. [1] https://api.jquery.com/change-shorthand/ Change-Id: Ia580ddf2ea5b0fba7feb400db759f59c0f5d958f --- horizon/static/horizon/js/horizon.users.js | 4 ++-- openstack_dashboard/static/js/horizon.instances.js | 4 ++-- openstack_dashboard/static/js/horizon.metering.js | 2 +- openstack_dashboard/static/js/horizon.networktopology.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/horizon/static/horizon/js/horizon.users.js b/horizon/static/horizon/js/horizon.users.js index 4059d6256c..7e8e8588c7 100644 --- a/horizon/static/horizon/js/horizon.users.js +++ b/horizon/static/horizon/js/horizon.users.js @@ -15,13 +15,13 @@ horizon.user = { init: function() { - $("#id_password").change(function () { + $("#id_password").on('change', function () { if ($("#id_confirm_password").val() !== "") { horizon.user.check_passwords_match(); } }); - $("#id_confirm_password").change(function () { + $("#id_confirm_password").on('change', function () { horizon.user.check_passwords_match(); }); }, diff --git a/openstack_dashboard/static/js/horizon.instances.js b/openstack_dashboard/static/js/horizon.instances.js index 82ee94962b..88f7af42ae 100644 --- a/openstack_dashboard/static/js/horizon.instances.js +++ b/openstack_dashboard/static/js/horizon.instances.js @@ -78,9 +78,9 @@ horizon.addInitFunction(horizon.instances.init = function () { update_launch_source_displayed_fields(this); }); - $('.workflow #id_source_type').change(); + $('.workflow #id_source_type').on('change', function() {}); horizon.modals.addModalInitFunction(function (modal) { - $(modal).find("#id_source_type").change(); + $(modal).find("#id_source_type").on('change', function() {}); }); /* diff --git a/openstack_dashboard/static/js/horizon.metering.js b/openstack_dashboard/static/js/horizon.metering.js index c339021906..e2adcf3967 100644 --- a/openstack_dashboard/static/js/horizon.metering.js +++ b/openstack_dashboard/static/js/horizon.metering.js @@ -37,7 +37,7 @@ horizon.metering = { } }, add_change_event_to_period_dropdown: function() { - $("#id_period").change(function(evt) { + $("#id_period").on('change', function(evt) { if (horizon.metering.show_or_hide_date_fields()) { evt.stopPropagation(); } diff --git a/openstack_dashboard/static/js/horizon.networktopology.js b/openstack_dashboard/static/js/horizon.networktopology.js index c94da29538..5d4f36e6e4 100644 --- a/openstack_dashboard/static/js/horizon.networktopology.js +++ b/openstack_dashboard/static/js/horizon.networktopology.js @@ -131,12 +131,12 @@ horizon.network_topology = { self.delete_balloon(); }); - angular.element('#toggle_labels').change(function() { + angular.element('#toggle_labels').on('change', function() { horizon.cookies.put('show_labels', this.checked); self.refresh_labels(); }); - angular.element('#toggle_networks').change(function() { + angular.element('#toggle_networks').on('change', function() { horizon.cookies.put('are_networks_collapsed', this.checked); self.refresh_networks(); self.refresh_labels();