Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Replace deprecated jQuery.fn.hover.
Anders Kaseorg97feea42a1f5
diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.jsindex b6772453421..508f484e33e 100644--- a/frontend_tests/node_tests/settings_user_groups.js+++ b/frontend_tests/node_tests/settings_user_groups.js@@ -430,17 +430,6 @@ run_test("with_external_user", () => {turned_off[event_name + "/" + sel] = true;};- let pill_hover_called = false;- let callback;- let empty_fn;- pill_stub.hover = function (one, two) {- callback = one;- empty_fn = two;- pill_hover_called = true;- assert.equal(typeof one, "function");- assert.equal(typeof two, "function");- };-const exit_button = $.create("fake-pill-exit");pill_stub.set_find_results(".exit", exit_button);let exit_button_called = false;@@ -487,14 +476,9 @@ run_test("with_external_user", () => {const event = {stopPropagation: noop,};- let pill_click_called = false;+ const pill_mouseenter_handler = pill_stub.get_on_handler("mouseenter");const pill_click_handler = pill_container_stub.get_on_handler("click");- pill_click_called = true;-- assert(callback);- assert(empty_fn);- callback();- empty_fn();+ pill_mouseenter_handler(event);pill_click_handler(event);assert.equal(delete_handler.call(fake_delete), undefined);assert.equal(name_update_handler(), undefined);@@ -506,8 +490,6 @@ run_test("with_external_user", () => {assert.equal(set_attributes_called, 1);assert.equal(can_edit_called, 9);assert(exit_button_called);- assert(pill_click_called);- assert(pill_hover_called);assert.equal(user_group_find_called, 2);assert.equal(pill_container_find_called, 4);assert.equal(turned_off["keydown/.pill"], true);diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.jsindex 3a7aff6bcd0..d9698ce477c 100644--- a/frontend_tests/node_tests/ui_init.js+++ b/frontend_tests/node_tests/ui_init.js@@ -190,8 +190,6 @@ $tab_bar.find = () => false;compose.compute_show_video_chat_button = () => {};$("#below-compose-content .video_link").toggle = () => {};-$("#tab_bar .narrow_description > a").hover = () => {};-run_test("initialize_everything", () => {ui_init.initialize_everything();});diff --git a/static/js/settings_user_groups.js b/static/js/settings_user_groups.jsindex 8c10d5b2d64..7ce34e67243 100644--- a/static/js/settings_user_groups.js+++ b/static/js/settings_user_groups.js@@ -80,12 +80,9 @@ exports.populate_user_groups = function () {pill_container.on("click", (e) => {e.stopPropagation();});- pill_container.find(".pill").hover(- () => {- pill_container.find(".pill").find(".exit").css("opacity", "0.5");- },- () => {},- );+ pill_container.find(".pill").on("mouseenter", () => {+ pill_container.find(".pill").find(".exit").css("opacity", "0.5");+ });}update_membership(data.id);diff --git a/static/js/stats/stats.js b/static/js/stats/stats.jsindex 3b1e549e8f1..d944fcfb55b 100644--- a/static/js/stats/stats.js+++ b/static/js/stats/stats.js@@ -81,9 +81,13 @@ $(() => {placement: "top",trigger: "manual",});- $("#id_last_update_question_sign").hover(() => {- $("span.last_update_tooltip").tooltip("toggle");- });+ $("#id_last_update_question_sign")+ .on("mouseenter", () => {+ $("span.last_update_tooltip").tooltip("show");+ })+ .on("mouseleave", () => {+ $("span.last_update_tooltip").tooltip("hide");+ });// Add configuration for any additional tooltips here.});diff --git a/static/js/tab_bar.js b/static/js/tab_bar.jsindex 0ae895c3993..ce3467cb77f 100644--- a/static/js/tab_bar.js+++ b/static/js/tab_bar.js@@ -97,14 +97,13 @@ function bind_title_area_handlers() {// handler that makes sure that hover plays nicely// with whether search is being opened or not.- $("#tab_bar .narrow_description > a").hover(- () => {+ $("#tab_bar .narrow_description > a")+ .on("mouseenter", () => {$("#tab_bar .search_closed").addClass("search_icon_hover_highlight");- },- () => {+ })+ .on("mouseleave", () => {$("#tab_bar .search_closed").removeClass("search_icon_hover_highlight");- },- );+ });}function build_tab_bar(filter) {