Avoid issues with mutable variable
authorAlexander Ebert <ebert@woltlab.com>
Wed, 31 Aug 2016 09:00:13 +0000 (11:00 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 31 Aug 2016 09:00:13 +0000 (11:00 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js

index 1bbcb4cd98eff0dd54b23067063f4435b5922fb1..e7b03dbe4bf0eed536b6152c56ed899cf7abf10e 100644 (file)
@@ -134,13 +134,6 @@ define(
                                span.className = 'icon icon24 fa-ellipsis-v';
                                button.appendChild(span);
                                
-                               var list = elBySel('.buttonList', navigation);
-                               list.addEventListener(WCF_CLICK_EVENT, function(event) {
-                                       event.stopPropagation();
-                                       
-                                       navigation.classList.remove('open');
-                               });
-                               
                                (function(navigation, button) {
                                        button.addEventListener(WCF_CLICK_EVENT, function(event) {
                                                event.preventDefault();
@@ -148,6 +141,13 @@ define(
                                                
                                                navigation.classList.toggle('open');
                                        });
+                                       
+                                       var list = elBySel('.buttonList', navigation);
+                                       list.addEventListener(WCF_CLICK_EVENT, function(event) {
+                                               event.stopPropagation();
+                                               
+                                               navigation.classList.remove('open');
+                                       });
                                })(navigation, button);
                                
                                navigation.insertBefore(button, navigation.firstChild);