diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-02-21 17:02:52 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-02-21 17:02:52 +0000 |
commit | d94afbee78a065169928bedbe4d9c3a5e20eeaec (patch) | |
tree | 93648429e9c1c2a6543db33c962b09616d4cf6ca /ui/ui.dialog.js | |
parent | 3342fb841a007f8e4769793c69c683e9ab6fbdcf (diff) | |
download | jquery-ui-d94afbee78a065169928bedbe4d9c3a5e20eeaec.tar.gz jquery-ui-d94afbee78a065169928bedbe4d9c3a5e20eeaec.zip |
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.
Diffstat (limited to 'ui/ui.dialog.js')
-rw-r--r-- | ui/ui.dialog.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 18f4bb6b7..6045fb51f 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -154,19 +154,24 @@ $.widget("ui.dialog", { }, 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() { |