Skip to content
Permalink
Browse files

Dialog: fixed triggered events.

  • Loading branch information
scottgonzalez committed Jul 10, 2008
1 parent 3370f9c commit dbddf389a240673e2f5f936aa597ebdd81b5440f
Showing with 16 additions and 4 deletions.
  1. +16 −4 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,15 +296,17 @@ $.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() {
(this.overlay && this.overlay.destroy());
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]
});
}
});

0 comments on commit dbddf38

Please sign in to comment.
You can’t perform that action at this time.