settings_account: Use `this` instead of event target.

The first two are equivalent because they call `closest`
and the last one is directly equivalent. We're making these
changes to aid with the conversion to typescript.
This commit is contained in:
evykassirer 2024-10-21 14:27:56 -07:00 committed by Tim Abbott
parent adf3280f1e
commit a6850410a8
1 changed files with 3 additions and 3 deletions

View File

@ -678,7 +678,7 @@ export function set_up() {
$("#profile-settings").on("click", ".custom_user_field .remove_date", (e) => { $("#profile-settings").on("click", ".custom_user_field .remove_date", (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const $field = $(e.target).closest(".custom_user_field").expectOne(); const $field = $(this).closest(".custom_user_field").expectOne();
const field_id = Number.parseInt($field.attr("data-field-id"), 10); const field_id = Number.parseInt($field.attr("data-field-id"), 10);
update_user_custom_profile_fields([{id: field_id}], channel.del); update_user_custom_profile_fields([{id: field_id}], channel.del);
}); });
@ -687,7 +687,7 @@ export function set_up() {
const fields = []; const fields = [];
const value = $(this).val(); const value = $(this).val();
const field_id = Number.parseInt( const field_id = Number.parseInt(
$(e.target).closest(".custom_user_field").attr("data-field-id"), $(this).closest(".custom_user_field").attr("data-field-id"),
10, 10,
); );
if (value) { if (value) {
@ -795,7 +795,7 @@ export function set_up() {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const $input_elem = $(e.currentTarget); const $input_elem = $(this);
const setting_name = $input_elem.attr("name"); const setting_name = $input_elem.attr("name");
const checked = $input_elem.prop("checked"); const checked = $input_elem.prop("checked");