click_handler: Use a variable for target's jquery instance.

This commit is contained in:
Aman Agrawal 2021-12-08 06:35:06 +00:00 committed by Tim Abbott
parent bf7224d04d
commit b3886af651
1 changed files with 4 additions and 5 deletions

View File

@ -647,16 +647,15 @@ export function initialize() {
}); });
function handle_compose_click(e) { function handle_compose_click(e) {
const $target = $(e.target);
// Emoji clicks should be handled by their own click handler in emoji_picker.js // Emoji clicks should be handled by their own click handler in emoji_picker.js
if ( if ($target.is(".emoji_map, img.emoji, .drag, .compose_gif_icon, .compose_control_menu")) {
$(e.target).is(".emoji_map, img.emoji, .drag, .compose_gif_icon, .compose_control_menu")
) {
return; return;
} }
// The mobile compose button has its own popover when clicked, so it already. // The mobile compose button has its own popover when clicked, so it already.
// hides other popovers. // hides other popovers.
if ($(e.target).is(".compose_mobile_button, .compose_mobile_button *")) { if ($target.is(".compose_mobile_button, .compose_mobile_button *")) {
return; return;
} }
@ -670,7 +669,7 @@ export function initialize() {
// clicking "Press Enter to send" should not // clicking "Press Enter to send" should not
// trigger the composebox-closing code in MAIN CLICK HANDLER. // trigger the composebox-closing code in MAIN CLICK HANDLER.
// But do allow our formatting link. // But do allow our formatting link.
if (!$(e.target).is("a")) { if (!$target.is("a")) {
e.stopPropagation(); e.stopPropagation();
} }
// Still hide the popovers, however // Still hide the popovers, however