]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
backdrop.js: cache `_getElement` calls
authorXhmikosR <xhmikosr@gmail.com>
Sat, 9 Oct 2021 18:50:21 +0000 (21:50 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Sat, 29 Jan 2022 11:25:30 +0000 (13:25 +0200)
js/src/util/backdrop.js

index 63f2b581c6a6bf7fe12f2ed1afea04b1ed4069b7..8f121e5bd2976c2b1403efa6dc4ed2ea9c324054 100644 (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)
     })