diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-07-10 00:47:25 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-07-10 00:47:25 +0000 |
commit | dbddf389a240673e2f5f936aa597ebdd81b5440f (patch) | |
tree | 09447b411fee5babf9eb486410de3e278e1f7bd2 /ui/ui.dialog.js | |
parent | 3370f9cc33e05b58d414ff73fdf332767ca6ccf4 (diff) | |
download | jquery-ui-dbddf389a240673e2f5f936aa597ebdd81b5440f.tar.gz jquery-ui-dbddf389a240673e2f5f936aa597ebdd81b5440f.zip |
Dialog: fixed triggered events.
Diffstat (limited to 'ui/ui.dialog.js')
-rw-r--r-- | ui/ui.dialog.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 7d29e1438..83f39b003 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -268,7 +268,7 @@ $.widget("ui.dialog", { this.moveToTop(true); // CALLBACK: open - var openEV = null; + var openEV = this.fakeEvent('dialogopen'); var openUI = { options: this.options }; @@ -281,9 +281,12 @@ $.widget("ui.dialog", { // the force parameter allows us to move modal dialogs to their correct // position on open moveToTop: function(force) { + if ((this.options.modal && !force) || (!this.options.stack && !this.options.modal)) { - return this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus); + return this.element.triggerHandler("dialogfocus", + [this.fakeEvent('dialogfocus'), { options: this.options }], + this.options.focus); } var maxZ = this.options.zIndex, options = this.options; @@ -293,7 +296,9 @@ $.widget("ui.dialog", { (this.overlay && this.overlay.$el.css('z-index', ++maxZ)); this.uiDialog.css('z-index', ++maxZ); - this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus); + this.element.triggerHandler("dialogfocus", + [this.fakeEvent('dialogfocus'), { options: this.options }], + this.options.focus); }, close: function() { @@ -301,7 +306,7 @@ $.widget("ui.dialog", { this.uiDialog.hide(this.options.hide); // CALLBACK: close - var closeEV = null; + var closeEV = this.fakeEvent('dialogclose'); var closeUI = { options: this.options }; @@ -340,6 +345,13 @@ $.widget("ui.dialog", { .appendTo(uiDialogButtonPane); }); } + }, + + fakeEvent: function(type) { + return $.event.fix({ + type: type, + target: this.element[0] + }); } }); |