diff --git a/js/src/util/backdrop.js b/js/src/util/backdrop.js index 63f2b581c6..8f121e5bd2 100644 --- a/js/src/util/backdrop.js +++ b/js/src/util/backdrop.js @@ -68,11 +68,12 @@ class Backdrop extends Config { this._append() + const element = this._getElement() if (this._config.isAnimated) { - reflow(this._getElement()) + reflow(element) } - this._getElement().classList.add(CLASS_NAME_SHOW) + element.classList.add(CLASS_NAME_SHOW) this._emulateAnimation(() => { execute(callback) @@ -130,9 +131,10 @@ class Backdrop extends Config { return } - this._config.rootElement.append(this._getElement()) + const element = this._getElement() + this._config.rootElement.append(element) - EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => { + EventHandler.on(element, EVENT_MOUSEDOWN, () => { execute(this._config.clickCallback) })