Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Replace deprecated $.trim method.
Anders Kaseorga2a587108891
diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.jsindex d3dd2526703..d9b01d2bf39 100644--- a/frontend_tests/node_tests/compose.js+++ b/frontend_tests/node_tests/compose.js@@ -1689,10 +1689,6 @@ run_test("create_message_object", () => {return "stream";};- global.$.trim = function (s) {- return s;- };-let message = compose.create_message_object();assert.equal(message.to, sub.stream_id);assert.equal(message.topic, "lunch");diff --git a/static/js/alert_words_ui.js b/static/js/alert_words_ui.jsindex 76e0848295a..2a86a3e41f8 100644--- a/static/js/alert_words_ui.js+++ b/static/js/alert_words_ui.js@@ -30,7 +30,7 @@ function update_alert_word_status(status_text, is_error) {}function add_alert_word(alert_word) {- alert_word = $.trim(alert_word);+ alert_word = alert_word.trim();if (alert_word === "") {update_alert_word_status(i18n.t("Alert word can't be empty!"), true);return;diff --git a/static/js/portico/signup.js b/static/js/portico/signup.jsindex bf9fe1e19a3..6abfa22cc4d 100644--- a/static/js/portico/signup.js+++ b/static/js/portico/signup.js@@ -125,7 +125,7 @@ $(() => {// check if it is the "focusout" or if it is a keydown, then check if// the keycode was the one for "enter" (13).if (e.type === "focusout" || e.which === 13) {- $(this).val($.trim($(this).val()));+ $(this).val($(this).val().trim());}});diff --git a/static/js/rendered_markdown.js b/static/js/rendered_markdown.jsindex 2f7eb157dbc..6d28727aae4 100644--- a/static/js/rendered_markdown.js+++ b/static/js/rendered_markdown.js@@ -171,7 +171,7 @@ exports.update_elements = (content) => {content.find("div.spoiler-header").each(function () {// If a spoiler block has no header content, it should have a default header.// We do this client side to allow for i18n by the client.- if ($.trim($(this).html()).length === 0) {+ if ($(this).html().trim().length === 0) {$(this).append(`<p>${i18n.t("Spoiler")}</p>`);}diff --git a/static/js/stream_color.js b/static/js/stream_color.jsindex 0227c7aace2..b8191eef9e0 100644--- a/static/js/stream_color.js+++ b/static/js/stream_color.js@@ -13,7 +13,7 @@ function update_table_stream_color(table, stream_name, color) {for (const label of stream_labels) {const $label = $(label);- if ($.trim($label.text()) === stream_name) {+ if ($label.text().trim() === stream_name) {const messages = $label.closest(".recipient_row").children(".message_row");messages.children(".messagebox")diff --git a/static/js/stream_create.js b/static/js/stream_create.jsindex c625922f3f9..c1135a4f965 100644--- a/static/js/stream_create.js+++ b/static/js/stream_create.js@@ -139,8 +139,8 @@ function get_principals() {function create_stream() {const data = {};- const stream_name = $.trim($("#create_stream_name").val());- const description = $.trim($("#create_stream_description").val());+ const stream_name = $("#create_stream_name").val().trim();+ const description = $("#create_stream_description").val().trim();created_stream = stream_name;// Even though we already check to make sure that while typing the user cannot enter@@ -406,7 +406,7 @@ exports.set_up_handlers = function () {e.preventDefault();clear_error_display();- const stream_name = $.trim($("#create_stream_name").val());+ const stream_name = $("#create_stream_name").val().trim();const name_ok = stream_name_error.validate_for_submit(stream_name);if (!name_ok) {@@ -444,7 +444,7 @@ exports.set_up_handlers = function () {});container.on("input", "#create_stream_name", () => {- const stream_name = $.trim($("#create_stream_name").val());+ const stream_name = $("#create_stream_name").val().trim();// This is an inexpensive check.stream_name_error.pre_validate(stream_name);diff --git a/static/js/stream_edit.js b/static/js/stream_edit.jsindex 9d390ec9da0..b39004abccd 100644--- a/static/js/stream_edit.js+++ b/static/js/stream_edit.js@@ -533,7 +533,7 @@ exports.change_stream_name = function (e) {const sub_settings = $(e.target).closest(".subscription_settings");const stream_id = get_stream_id(e.target);const new_name_box = sub_settings.find(".stream-name-editable");- const new_name = $.trim(new_name_box.text());+ const new_name = new_name_box.text().trim();$(".stream_change_property_info").hide();channel.patch({diff --git a/static/js/subs.js b/static/js/subs.jsindex 5289a49578c..a15f283954d 100644--- a/static/js/subs.js+++ b/static/js/subs.js@@ -884,7 +884,7 @@ exports.do_open_create_stream = function () {// Only call this directly for hash changes.// Prefer open_create_stream().- const stream = $.trim($("#search_stream_name").val());+ const stream = $("#search_stream_name").val().trim();if (!should_list_all_streams()) {// Realms that don't allow listing streams should simply be subscribed to.