From 314b72c80097c161be009368601bc54742e46507 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Souk=C3=A9ina=20Bojabza?= <sobo@odoo.com>
Date: Thu, 7 Sep 2023 09:41:45 +0200
Subject: [PATCH] [FIX] website: fix removing an animation from an element

Before this commit, when removing an animation from an element, all the
animation related classes and styles were not removed, leaving the DOM
in an inconsistent state.

This commit fixes that.

task-3497015

closes odoo/odoo#134624

Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
---
 .../static/src/js/editor/snippets.options.js       | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js
index ff7caa93d002..b5499190ac2a 100644
--- a/addons/website/static/src/js/editor/snippets.options.js
+++ b/addons/website/static/src/js/editor/snippets.options.js
@@ -3399,8 +3399,18 @@ options.registry.WebsiteAnimate = options.Class.extend({
     async selectClass(previewMode, widgetValue, params) {
         await this._super(...arguments);
         if (params.isAnimationTypeSelection) {
-            this._forceAnimation();
-            this.$target.toggleClass('o_animate_preview o_animate', !!widgetValue);
+            if (params.name !== "no_animation_opt") {
+                this._forceAnimation();
+                this.$target[0].classList.add("o_animate_preview", "o_animate");
+            } else {
+                this.$target[0].classList.remove("o_animate_preview", "o_animate", "o_animating",
+                    "o_animated", "o_animate_in_dropdown", "o_animate_both_scroll");
+                this.$target[0].style.animationName = "";
+                this.$target[0].style.animationPlayState = "";
+                this.$target[0].style.animationDuration = "";
+                this.$target[0].style.animationDelay = "";
+                this.$target[0].style.visibility = "";
+            }
         }
     },
 
-- 
GitLab