From 3efda9c6e6dd931488adc9f1299f1246ab2ce978 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 22 May 2015 23:54:56 +0200 Subject: [PATCH] Eagerly set up Dictionaries --- .../install/files/js/WoltLab/WCF/Controller/Popover.js | 10 +++------- wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js | 4 +--- .../install/files/js/WoltLab/WCF/UI/Dropdown/Simple.js | 10 +++------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js index 8334bf604e..3c9790d43c 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js @@ -11,9 +11,9 @@ define(['Dictionary', 'Environment', 'DOM/Util', 'UI/Alignment'], function(Dicti var _activeId = null; var _baseHeight = 0; - var _cache = null; - var _elements = null; - var _handlers = null; + var _cache = new Dictionary(); + var _elements = new Dictionary(); + var _handlers = new Dictionary(); var _hoverId = null; var _suspended = false; var _timeoutEnter = null; @@ -48,10 +48,6 @@ define(['Dictionary', 'Environment', 'DOM/Util', 'UI/Alignment'], function(Dicti return; } - _cache = new Dictionary(); - _elements = new Dictionary(); - _handlers = new Dictionary(); - _popover = document.createElement('div'); _popover.classList.add('popover'); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js b/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js index 3d9258cacb..f181f04771 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js @@ -11,7 +11,7 @@ define(['enquire', 'Core', 'Dictionary', 'Environment', 'Language', 'DOM/Util'], var _activeDialog = null; var _container = null; - var _dialogs = null; + var _dialogs = new Dictionary(); var _dialogFullHeight = false; var _keyupListener = null; @@ -31,8 +31,6 @@ define(['enquire', 'Core', 'Dictionary', 'Environment', 'Language', 'DOM/Util'], document.body.appendChild(_container); - _dialogs = new Dictionary(); - _keyupListener = (function(event) { if (event.keyCode === 27) { if (event.target.nodeName !== 'INPUT' && event.target.nodeName !== 'TEXTAREA') { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/UI/Dropdown/Simple.js b/wcfsetup/install/files/js/WoltLab/WCF/UI/Dropdown/Simple.js index 790f623a8b..9a2823d75d 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/UI/Dropdown/Simple.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/UI/Dropdown/Simple.js @@ -13,9 +13,9 @@ define( "use strict"; var _availableDropdowns = null; - var _callbacks = null; - var _dropdowns = null; - var _menus = null; + var _callbacks = new CallbackList(); + var _dropdowns = new Dictionary(); + var _menus = new Dictionary(); var _menuContainer = null; /** @@ -31,10 +31,6 @@ define( _menuContainer.setAttribute('id', 'dropdownMenuContainer'); document.body.appendChild(_menuContainer); - _callbacks = new CallbackList(); - _dropdowns = new Dictionary(); - _menus = new Dictionary(); - _availableDropdowns = document.getElementsByClassName('dropdownToggle'); this.initAll(); -- 2.20.1