Fixed popover on page unload
authorAlexander Ebert <ebert@woltlab.com>
Mon, 18 May 2015 15:27:16 +0000 (17:27 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 18 May 2015 15:27:16 +0000 (17:27 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js

index b0207aa8ed52ac546c5b5e20aa50ce5bc06fa4f5..80a13d0c24cecc69355633f1fefd87a4e451dfd7 100644 (file)
@@ -15,6 +15,7 @@ define(['Dictionary', 'DOM/Util', 'UI/Alignment'], function(Dictionary, DOMUtil,
        var _elements = null;
        var _handlers = null;
        var _hoverId = null;
+       var _suspended = false;
        var _timeoutEnter = null;
        var _timeoutLeave = null;
        
@@ -88,6 +89,11 @@ define(['Dictionary', 'DOM/Util', 'UI/Alignment'], function(Dictionary, DOMUtil,
                        
                        window.addEventListener('beforeunload', (function() {
                                _suspended = true;
+                               
+                               if (_timeoutEnter !== null) {
+                                       window.clearTimeout(_timeoutEnter);
+                               }
+                               
                                this._hide(true);
                        }).bind(this));
                        
@@ -228,6 +234,10 @@ define(['Dictionary', 'DOM/Util', 'UI/Alignment'], function(Dictionary, DOMUtil,
                 * @param       {object}        event   event object
                 */
                _mouseEnter: function(event) {
+                       if (_suspended) {
+                               return;
+                       }
+                       
                        if (_timeoutEnter !== null) {
                                window.clearTimeout(_timeoutEnter);
                                _timeoutEnter = null;