sponsorship: Avoid slow jQuery :selected selector extension.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-09-04 11:50:15 -07:00 committed by Tim Abbott
parent 081c0dc97f
commit cf186a4d86
1 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,8 @@ import $ from "jquery";
import assert from "minimalistic-assert";
import {z} from "zod";
import {the} from "../util";
import * as helpers from "./helpers";
const is_remotely_hosted = $("#sponsorship-form").attr("data-is-remotely-hosted") === "True";
@ -93,9 +95,8 @@ export function initialize(): void {
function update_discount_details(): void {
const selected_org_type =
$<HTMLSelectElement>("select#organization-type")
.find(":selected")
.attr("data-string-value") ?? "";
the($<HTMLSelectElement>("select#organization-type")).selectedOptions[0]?.dataset
.stringValue ?? "";
helpers.update_discount_details(selected_org_type, is_remotely_hosted);
}