Skip to content

Commit

Permalink
Really moved updateMaxZ into dialog prototype this time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Akkuma committed Oct 31, 2011
1 parent b15c419 commit e2bebd4
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions ui/jquery.ui.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
},
dialogs = {};

function updateMaxZ($currentDialog) {
var self = this,
maxZ = self.options.zIndex;

$.each(dialogs, function() {
if (this.uiDialog[0] !== self.uiDialog[0] && this._isOpen) {
thisZ = this.uiDialog.css('z-index');
if(!isNaN(thisZ)) {
maxZ = Math.max(maxZ, thisZ);
}
}
});
$.ui.dialog.maxZ = maxZ;
}

$.widget("ui.dialog", {
version: "@VERSION",
options: {
Expand Down Expand Up @@ -243,11 +228,26 @@ $.widget("ui.dialog", {

// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
if (self.options.modal) {
updateMaxZ.call(self);
self._updateMaxZ();
}

return self;
},

_updateMaxZ: function() {
var self = this,
maxZ = self.options.zIndex;

$.each(dialogs, function() {
if (this.uiDialog[0] !== self.uiDialog[0] && this._isOpen) {
thisZ = this.uiDialog.css('z-index');
if(!isNaN(thisZ)) {
maxZ = Math.max(maxZ, thisZ);
}
}
});
$.ui.dialog.maxZ = maxZ;
},

isOpen: function() {
return this._isOpen;
Expand All @@ -267,7 +267,7 @@ $.widget("ui.dialog", {

//moveToTop method does not have a true/false passed down from dialog('moveToTop')
if (force || force === undefined) {
updateMaxZ.call(self);
self._updateMaxZ();

if (self.overlay) {
$.ui.dialog.maxZ += 1;
Expand Down

0 comments on commit e2bebd4

Please sign in to comment.