From 4d1baf9550713b0de821ab0b6719f80c016dc8e3 Mon Sep 17 00:00:00 2001 From: untemps Date: Sun, 30 Jan 2022 15:13:40 +0100 Subject: [PATCH] fix: Fix classNames reassignment when content is updated, #15 --- src/Tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tooltip.js b/src/Tooltip.js index fb967e4..2197874 100644 --- a/src/Tooltip.js +++ b/src/Tooltip.js @@ -115,11 +115,11 @@ class Tooltip { this.#createTooltip() } - if (hasContainerClassNameChanged) { + if (hasContainerClassNameChanged || hasContentChanged) { this.#tooltip.classList.add(this.#containerClassName || '__tooltip') } - if (hasPositionChanged) { + if (hasPositionChanged || hasContainerClassNameChanged || hasContentChanged) { this.#tooltip.classList.remove(`__tooltip-${oldPosition}`) this.#tooltip.classList.add(`__tooltip-${this.#position}`) }