]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Modal: drop loop (#38368)
authorXhmikosR <xhmikosr@gmail.com>
Wed, 29 Mar 2023 08:00:31 +0000 (11:00 +0300)
committerGitHub <noreply@github.com>
Wed, 29 Mar 2023 08:00:31 +0000 (11:00 +0300)
We only have two elements to iterate over so it doesn't make a lot of sense to use a loop here

js/src/modal.js

index 454d46aea2d48103247e5626ff23066b27fc25a2..c4c4102042d58620c4d67fb0717c5849d95be1eb 100644 (file)
@@ -139,12 +139,12 @@ class Modal extends BaseComponent {
   }
 
   dispose() {
-    for (const htmlElement of [window, this._dialog]) {
-      EventHandler.off(htmlElement, EVENT_KEY)
-    }
+    EventHandler.off(window, EVENT_KEY)
+    EventHandler.off(this._dialog, EVENT_KEY)
 
     this._backdrop.dispose()
     this._focustrap.deactivate()
+
     super.dispose()
   }