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

@@ -312,7 +312,7 @@ export const update_elements = ($content: JQuery): void => {
$view_in_playground_button.attr("aria-label", title);
}
const $copy_button = $buttonContainer.find(".copy_codeblock");
const clipboard = new ClipboardJS($copy_button[0]!, {
const clipboard = new ClipboardJS(util.the($copy_button), {
text(copy_element) {
const $code = $(copy_element).parent().siblings("code");
return $code.text();
@@ -320,7 +320,7 @@ export const update_elements = ($content: JQuery): void => {
});
clipboard.on("success", () => {
show_copied_confirmation($copy_button[0]!);
show_copied_confirmation(util.the($copy_button));
});
$codehilite.addClass("zulip-code-block");
});