mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
js: Optimize out unnecessary jQuery filter calls.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
fd11c9c666
commit
72cc78dfa3
@@ -189,7 +189,7 @@ exports.hide_emoji_popover = function () {
|
||||
};
|
||||
|
||||
function get_selected_emoji() {
|
||||
return $(".emoji-popover-emoji").filter(":focus")[0];
|
||||
return $(".emoji-popover-emoji:focus")[0];
|
||||
}
|
||||
|
||||
function get_rendered_emoji(section, index) {
|
||||
|
||||
@@ -396,7 +396,7 @@ exports.process_tab_key = function () {
|
||||
|
||||
let message_edit_form;
|
||||
|
||||
const focused_message_edit_content = $(".message_edit_content").filter(":focus");
|
||||
const focused_message_edit_content = $(".message_edit_content:focus");
|
||||
if (focused_message_edit_content.length > 0) {
|
||||
message_edit_form = focused_message_edit_content.closest(".message_edit_form");
|
||||
// Open message edit forms either have a save button or a close button, but not both.
|
||||
@@ -404,7 +404,7 @@ exports.process_tab_key = function () {
|
||||
return true;
|
||||
}
|
||||
|
||||
const focused_message_edit_save = $(".message_edit_save").filter(":focus");
|
||||
const focused_message_edit_save = $(".message_edit_save:focus");
|
||||
if (focused_message_edit_save.length > 0) {
|
||||
message_edit_form = focused_message_edit_save.closest(".message_edit_form");
|
||||
message_edit_form.find(".message_edit_cancel").trigger("focus");
|
||||
@@ -431,13 +431,13 @@ exports.process_shift_tab_key = function () {
|
||||
}
|
||||
|
||||
// Shift-Tabbing from the edit message cancel button takes you to save.
|
||||
if ($(".message_edit_cancel").filter(":focus").length > 0) {
|
||||
if ($(".message_edit_cancel:focus").length > 0) {
|
||||
$(".message_edit_save").trigger("focus");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Shift-Tabbing from the edit message save button takes you to the content.
|
||||
const focused_message_edit_save = $(".message_edit_save").filter(":focus");
|
||||
const focused_message_edit_save = $(".message_edit_save:focus");
|
||||
if (focused_message_edit_save.length > 0) {
|
||||
focused_message_edit_save
|
||||
.closest(".message_edit_form")
|
||||
|
||||
@@ -216,7 +216,7 @@ function handle_message_row_edit_keydown(e) {
|
||||
if ($(e.target).hasClass("message_edit_content")) {
|
||||
// Pressing Enter to save edits is coupled with Enter to send
|
||||
if (composebox_typeahead.should_enter_send(e)) {
|
||||
const row = $(".message_edit_content").filter(":focus").closest(".message_row");
|
||||
const row = $(".message_edit_content:focus").closest(".message_row");
|
||||
const message_edit_save_button = row.find(".message_edit_save");
|
||||
if (message_edit_save_button.prop("disabled")) {
|
||||
// In cases when the save button is disabled
|
||||
|
||||
@@ -26,7 +26,7 @@ const show_step = function ($process, step) {
|
||||
};
|
||||
|
||||
const get_step = function ($process) {
|
||||
return $process.find("[data-step]").filter(":visible").data("step");
|
||||
return $process.find("[data-step]:visible").data("step");
|
||||
};
|
||||
|
||||
function should_show_notifications(ls) {
|
||||
|
||||
Reference in New Issue
Block a user