From 1dbfd086f8a97e3984a52e03560382a26a72ce65 Mon Sep 17 00:00:00 2001 From: Rahil Ghanchi Date: Mon, 1 Apr 2024 12:19:57 +0530 Subject: [PATCH] [FIX] mass_mailing, website: fix the weird spaces in rating snippet To reproduce the issue: -Drag and drop the rating snippet. -Change the score from options. -Notice that spaces between icons disappear. In the release notes[1] of jQuery 3.5.0, it's stated that security fixes related to the HTML parser were implemented. Consequently, self-closing e.g. `` tags inside function arguments were replaced with e.g. ``. As a result, trailing spaces lost significance, causing icons to stick together. Before the commit: Prior to Odoo 16.2, jQuery 3.3.1 was utilized, which allowed the use of self-closing tags in the append function. This behavior was as expected.However, starting from Odoo 16.2, jQuery version 3.6.3 was adopted. After the commit: Instead of using self-closing `` tags, ` ` with a trailing space was used. This trailing space gained significance due to the prefilter no longer ignoring it. Consequently, icons no longer stick together after changing the score. task-3576760 [1] https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/ closes odoo/odoo#161076 X-original-commit: b897e836697a288bbd58a8efc340d9f7b2e76e30 Signed-off-by: Romain Derie (rde) --- addons/mass_mailing/static/src/snippets/s_rating/options.js | 4 ++-- addons/website/static/src/snippets/s_rating/options.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mass_mailing/static/src/snippets/s_rating/options.js b/addons/mass_mailing/static/src/snippets/s_rating/options.js index 87089c3728e..138f57ae811 100644 --- a/addons/mass_mailing/static/src/snippets/s_rating/options.js +++ b/addons/mass_mailing/static/src/snippets/s_rating/options.js @@ -111,9 +111,9 @@ options.registry.Rating = options.Class.extend({ this.$target.find('.s_rating_icons i').remove(); for (let i = 0; i < this.nbTotalIcons; i++) { if (i < this.nbActiveIcons) { - $activeIcons.append(' '); + $activeIcons.append(' '); } else { - $inactiveIcons.append(' '); + $inactiveIcons.append(' '); } } this._renderIcons(); diff --git a/addons/website/static/src/snippets/s_rating/options.js b/addons/website/static/src/snippets/s_rating/options.js index 315a4890f71..8c07dd1dae7 100644 --- a/addons/website/static/src/snippets/s_rating/options.js +++ b/addons/website/static/src/snippets/s_rating/options.js @@ -112,9 +112,9 @@ options.registry.Rating = options.Class.extend({ this.$target.find('.s_rating_icons i').remove(); for (let i = 0; i < this.nbTotalIcons; i++) { if (i < this.nbActiveIcons) { - $activeIcons.append(' '); + $activeIcons.append(' '); } else { - $inactiveIcons.append(' '); + $inactiveIcons.append(' '); } } this._renderIcons();