r2119 - trunk/ui

r2119 - trunk/ui


Author: scott.gonzalez
Date: Sat Feb 21 09:02:52 2009
New Revision: 2119
Modified:
trunk/ui/ui.dialog.js
Log:
Dialog: When animating dialog close, wait until after the animation
completes before triggering the close event. Fixes #4207 - Dialog close
event occurs too early with hide effect.
Modified: trunk/ui/ui.dialog.js
==============================================================================
--- trunk/ui/ui.dialog.js    (original)
+++ trunk/ui/ui.dialog.js    Sat Feb 21 09:02:52 2009
@@ -154,19 +154,24 @@
    },
    close: function(event) {
-        if (false === this._trigger('beforeclose', event)) {
+        var self = this;
+        
+        if (false === self._trigger('beforeclose', event)) {
            return;
        }
-        (this.overlay && this.overlay.destroy());
-        this.uiDialog
-            .hide(this.options.hide)
-            .unbind('keypress.ui-dialog');
+        (self.overlay && self.overlay.destroy());
+        self.uiDialog.unbind('keypress.ui-dialog');
+
+        (self.options.hide
+            ? self.uiDialog.hide(self.options.hide, function() {
+                self._trigger('close', event);
+            })
+            : self._trigger('close', event));
-        this._trigger('close', event);
        $.ui.dialog.overlay.resize();
-        this._isOpen = false;
+        self._isOpen = false;
    },
    isOpen: function() {