Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

sponsorship: Avoid slow jQuery :selected selector extension.

Anders Kaseorgcf186a4d8661
diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts
index 58f8b30bfc1..101afe5db12 100644
--- a/web/src/billing/sponsorship.ts
+++ b/web/src/billing/sponsorship.ts
@@ -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);
}