web: Use util.the for accessing element of single-item lists.

This commit is contained in:
evykassirer
2024-08-19 22:18:02 -07:00
committed by Tim Abbott
parent 113de14547
commit d9f25d01a1
47 changed files with 188 additions and 140 deletions

View File

@@ -2,6 +2,7 @@ import $ from "jquery";
import * as tippy from "tippy.js";
import {$t} from "./i18n";
import * as util from "./util";
export const status_classes = "alert-error alert-success alert-info alert-warning alert-loading";
@@ -108,7 +109,7 @@ function set_password_toggle_label(
): void {
$(password_selector).attr("aria-label", label);
if (tippy_tooltips) {
const element: tippy.ReferenceElement = $(password_selector)[0]!;
const element: tippy.ReferenceElement = util.the($(password_selector));
const tippy_instance = element._tippy ?? tippy.default(element);
tippy_instance.setContent(label);
} else {