0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

backdrop.js: cache _getElement calls

This commit is contained in:
XhmikosR 2021-10-09 21:50:21 +03:00
parent 0c3dfe104b
commit 3ac4451d47

View File

@ -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)
})