From 1edec546cb28baf68691f0eb9e43997901359ba5 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 10 Dec 2020 16:54:50 +0200 Subject: [PATCH] Remove `TRANSITION_END` from utils (#32394) --- js/src/alert.js | 3 +-- js/src/carousel.js | 3 +-- js/src/collapse.js | 5 ++--- js/src/modal.js | 15 +++++++-------- js/src/tab.js | 3 +-- js/src/toast.js | 5 ++--- js/src/tooltip.js | 5 ++--- js/src/util/index.js | 1 - 8 files changed, 16 insertions(+), 24 deletions(-) diff --git a/js/src/alert.js b/js/src/alert.js index 5a12318820..96eda4c5fa 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -7,7 +7,6 @@ import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, getElementFromSelector, getTransitionDurationFromElement @@ -83,7 +82,7 @@ class Alert extends BaseComponent { const transitionDuration = getTransitionDurationFromElement(element) - EventHandler.one(element, TRANSITION_END, () => this._destroyElement(element)) + EventHandler.one(element, 'transitionend', () => this._destroyElement(element)) emulateTransitionEnd(element, transitionDuration) } diff --git a/js/src/carousel.js b/js/src/carousel.js index b5923e34a6..e1432d924b 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -7,7 +7,6 @@ import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, getElementFromSelector, getTransitionDurationFromElement, @@ -480,7 +479,7 @@ class Carousel extends BaseComponent { const transitionDuration = getTransitionDurationFromElement(activeElement) - EventHandler.one(activeElement, TRANSITION_END, () => { + EventHandler.one(activeElement, 'transitionend', () => { nextElement.classList.remove(directionalClassName, orderClassName) nextElement.classList.add(CLASS_NAME_ACTIVE) diff --git a/js/src/collapse.js b/js/src/collapse.js index 590615b724..90bab0ec9a 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -7,7 +7,6 @@ import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, getSelectorFromElement, getElementFromSelector, @@ -203,7 +202,7 @@ class Collapse extends BaseComponent { const scrollSize = `scroll${capitalizedDimension}` const transitionDuration = getTransitionDurationFromElement(this._element) - EventHandler.one(this._element, TRANSITION_END, complete) + EventHandler.one(this._element, 'transitionend', complete) emulateTransitionEnd(this._element, transitionDuration) this._element.style[dimension] = `${this._element[scrollSize]}px` @@ -253,7 +252,7 @@ class Collapse extends BaseComponent { this._element.style[dimension] = '' const transitionDuration = getTransitionDurationFromElement(this._element) - EventHandler.one(this._element, TRANSITION_END, complete) + EventHandler.one(this._element, 'transitionend', complete) emulateTransitionEnd(this._element, transitionDuration) } diff --git a/js/src/modal.js b/js/src/modal.js index 20fb215c6d..87c22943ad 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -7,7 +7,6 @@ import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, getElementFromSelector, getTransitionDurationFromElement, @@ -184,7 +183,7 @@ class Modal extends BaseComponent { if (transition) { const transitionDuration = getTransitionDurationFromElement(this._element) - EventHandler.one(this._element, TRANSITION_END, event => this._hideModal(event)) + EventHandler.one(this._element, 'transitionend', event => this._hideModal(event)) emulateTransitionEnd(this._element, transitionDuration) } else { this._hideModal() @@ -272,7 +271,7 @@ class Modal extends BaseComponent { if (transition) { const transitionDuration = getTransitionDurationFromElement(this._dialog) - EventHandler.one(this._dialog, TRANSITION_END, transitionComplete) + EventHandler.one(this._dialog, 'transitionend', transitionComplete) emulateTransitionEnd(this._dialog, transitionDuration) } else { transitionComplete() @@ -377,7 +376,7 @@ class Modal extends BaseComponent { const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop) - EventHandler.one(this._backdrop, TRANSITION_END, callback) + EventHandler.one(this._backdrop, 'transitionend', callback) emulateTransitionEnd(this._backdrop, backdropTransitionDuration) } else if (!this._isShown && this._backdrop) { this._backdrop.classList.remove(CLASS_NAME_SHOW) @@ -389,7 +388,7 @@ class Modal extends BaseComponent { if (this._element.classList.contains(CLASS_NAME_FADE)) { const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop) - EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove) + EventHandler.one(this._backdrop, 'transitionend', callbackRemove) emulateTransitionEnd(this._backdrop, backdropTransitionDuration) } else { callbackRemove() @@ -413,11 +412,11 @@ class Modal extends BaseComponent { this._element.classList.add(CLASS_NAME_STATIC) const modalTransitionDuration = getTransitionDurationFromElement(this._dialog) - EventHandler.off(this._element, TRANSITION_END) - EventHandler.one(this._element, TRANSITION_END, () => { + EventHandler.off(this._element, 'transitionend') + EventHandler.one(this._element, 'transitionend', () => { this._element.classList.remove(CLASS_NAME_STATIC) if (!isModalOverflowing) { - EventHandler.one(this._element, TRANSITION_END, () => { + EventHandler.one(this._element, 'transitionend', () => { this._element.style.overflowY = '' }) emulateTransitionEnd(this._element, modalTransitionDuration) diff --git a/js/src/tab.js b/js/src/tab.js index 3a48986c47..c882ecd16a 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -7,7 +7,6 @@ import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, getElementFromSelector, getTransitionDurationFromElement, @@ -132,7 +131,7 @@ class Tab extends BaseComponent { const transitionDuration = getTransitionDurationFromElement(active) active.classList.remove(CLASS_NAME_SHOW) - EventHandler.one(active, TRANSITION_END, complete) + EventHandler.one(active, 'transitionend', complete) emulateTransitionEnd(active, transitionDuration) } else { complete() diff --git a/js/src/toast.js b/js/src/toast.js index bda152af66..e277cdc068 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -7,7 +7,6 @@ import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, getTransitionDurationFromElement, reflow, @@ -116,7 +115,7 @@ class Toast extends BaseComponent { if (this._config.animation) { const transitionDuration = getTransitionDurationFromElement(this._element) - EventHandler.one(this._element, TRANSITION_END, complete) + EventHandler.one(this._element, 'transitionend', complete) emulateTransitionEnd(this._element, transitionDuration) } else { complete() @@ -143,7 +142,7 @@ class Toast extends BaseComponent { if (this._config.animation) { const transitionDuration = getTransitionDurationFromElement(this._element) - EventHandler.one(this._element, TRANSITION_END, complete) + EventHandler.one(this._element, 'transitionend', complete) emulateTransitionEnd(this._element, transitionDuration) } else { complete() diff --git a/js/src/tooltip.js b/js/src/tooltip.js index d348e0a0da..4eb4fde0bf 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -9,7 +9,6 @@ import * as Popper from '@popperjs/core' import { defineJQueryPlugin, - TRANSITION_END, emulateTransitionEnd, findShadowRoot, getTransitionDurationFromElement, @@ -317,7 +316,7 @@ class Tooltip extends BaseComponent { if (this.tip.classList.contains(CLASS_NAME_FADE)) { const transitionDuration = getTransitionDurationFromElement(this.tip) - EventHandler.one(this.tip, TRANSITION_END, complete) + EventHandler.one(this.tip, 'transitionend', complete) emulateTransitionEnd(this.tip, transitionDuration) } else { complete() @@ -367,7 +366,7 @@ class Tooltip extends BaseComponent { if (this.tip.classList.contains(CLASS_NAME_FADE)) { const transitionDuration = getTransitionDurationFromElement(tip) - EventHandler.one(tip, TRANSITION_END, complete) + EventHandler.one(tip, 'transitionend', complete) emulateTransitionEnd(tip, transitionDuration) } else { complete() diff --git a/js/src/util/index.js b/js/src/util/index.js index 1bf9fe9548..9ccad1cbb1 100644 --- a/js/src/util/index.js +++ b/js/src/util/index.js @@ -205,7 +205,6 @@ const defineJQueryPlugin = (name, plugin) => { } export { - TRANSITION_END, getUID, getSelectorFromElement, getElementFromSelector,