chore(tooltips): all tooltips classes are removed in a loop

This commit is contained in:
Johannes Eder 2021-08-24 14:38:26 +02:00 committed by Sarah Vaupel
parent 5b4ac75874
commit f19e9bab92

View File

@ -190,13 +190,12 @@ export class Tooltip {
destroy() {
this._eventManager.cleanUp();
if(this._element.classList.contains(TOOLTIP_OPEN_CLASS))
this._element.classList.remove(TOOLTIP_OPEN_CLASS);
if(this._element.classList.contains('tooltip--right'))
this._element.classList.remove('tooltip--right');
if(this._element.classList.contains('tooltip--bottom'))
this._element.classList.remove('tooltip--bottom');
this._movementObserver.unobserve();
this._element.classList.remove(TOOLTIP_INITIALIZED_CLASS);
for (let i = 0; i < this._element.classList.length; i++) {
if (/tooltip--*/.test(this._element.classList[i]))
this._element.classList.remove(this._element.classList.item(i));
else
i++;
}
}
};