web: Avoid slow jQuery :input, :checkbox, :radio selectors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-05-01 21:48:01 -07:00
committed by Tim Abbott
parent 7aa1763d73
commit ff2a7b775a
3 changed files with 4 additions and 4 deletions

View File

@@ -153,7 +153,7 @@ export function launch(conf: WidgetConfig): void {
}
if (conf.update_submit_disabled_state_on_change) {
const $inputs = $dialog.find(".modal__content :input");
const $inputs = $dialog.find(".modal__content").find("input,select,textarea,button");
const original_values = get_current_values($inputs);

View File

@@ -320,12 +320,12 @@ function open_invite_user_modal(e) {
});
$("#invite_check_all_button").on("click", () => {
$("#streams_to_add :checkbox").prop("checked", true);
$("#streams_to_add input[type=checkbox]").prop("checked", true);
toggle_invite_submit_button();
});
$("#invite_uncheck_all_button").on("click", () => {
$("#streams_to_add :checkbox").prop("checked", false);
$("#streams_to_add input[type=checkbox]").prop("checked", false);
$("#invite-user-modal .dialog_submit_button").prop(
"disabled",
!$("#generate_multiuse_invite_radio").is(":checked"),

View File

@@ -133,7 +133,7 @@ function update_announce_stream_state() {
const $announce_stream_checkbox = $("#announce-new-stream input");
const $announce_stream_label = $("#announce-new-stream");
let disable_it = false;
const privacy_type = $("#stream_creation_form input:radio[name=privacy]:checked").val();
const privacy_type = $("#stream_creation_form input[type=radio][name=privacy]:checked").val();
const is_invite_only =
privacy_type === "invite-only" || privacy_type === "invite-only-public-history";
$announce_stream_label.removeClass("control-label-disabled");