js: Fix no-jquery/no-sizzle.

The :first and :last selectors were deprecated in jQuery 3.4.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-03-16 14:29:41 -07:00 committed by Tim Abbott
parent 8ef2c0a604
commit eb7770565a
4 changed files with 8 additions and 6 deletions

View File

@ -82,12 +82,12 @@ export class SettingsPanelMenu {
}
prev() {
this.$curr_li.prevAll(":visible:first").trigger("focus").trigger("click");
this.$curr_li.prevAll(":visible").first().trigger("focus").trigger("click");
return true;
}
next() {
this.$curr_li.nextAll(":visible:first").trigger("focus").trigger("click");
this.$curr_li.nextAll(":visible").first().trigger("focus").trigger("click");
return true;
}

View File

@ -126,7 +126,7 @@ function clear_form_data() {
$("#custom_external_account_url_pattern").hide();
$("#profile_field_external_accounts").hide();
$("#profile_field_external_accounts_type").val(
$("#profile_field_external_accounts_type option:first").val(),
$("#profile_field_external_accounts_type option:first-child").val(),
);
}

View File

@ -294,7 +294,7 @@ export function show_new_stream_modal() {
stream_create_subscribers.build_widgets();
// Select the first visible and enabled choice for stream privacy.
$("#make-invite-only input:visible:not([disabled]):first").prop("checked", true);
$("#make-invite-only input:visible:not([disabled])").first().prop("checked", true);
// Make the options default to the same each time:
// "announce stream" on.
$("#stream_creation_form .stream-message-retention-days-input").hide();

View File

@ -1022,12 +1022,14 @@ export function update_web_public_stream_privacy_option_state($container) {
}
$web_public_stream_elem.closest(".radio-input-parent").hide();
$container
.find(".stream-privacy-values .radio-input-parent:visible:last")
.find(".stream-privacy-values .radio-input-parent:visible")
.last()
.css("border-bottom", "none");
} else {
if (!$web_public_stream_elem.is(":visible")) {
$container
.find(".stream-privacy-values .radio-input-parent:visible:last")
.find(".stream-privacy-values .radio-input-parent:visible")
.last()
.css("border-bottom", "");
$web_public_stream_elem.closest(".radio-input-parent").show();
}