diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-03-03 02:11:37 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-03-03 02:11:37 +0000 |
commit | eb93c743dedd402a8613beed50f136d4c89fda5c (patch) | |
tree | 73e343cd849397513a4d0ed714bf522e27c45638 | |
parent | c91e1cc86a2b13bdc6e97a669829b582676154c1 (diff) | |
download | jquery-ui-eb93c743dedd402a8613beed50f136d4c89fda5c.tar.gz jquery-ui-eb93c743dedd402a8613beed50f136d4c89fda5c.zip |
Dialog: Fixed modal overlay instance tracking.
Fixes #5228 - $.inArray's parameter.
Fixes #5263 - Dialog Close Then Destroy Destroys Overlay Twice, Causes Exceptions Later.
-rw-r--r-- | ui/jquery.ui.dialog.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 2e91a9e5a..12db06ded 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -630,12 +630,12 @@ $.extend($.ui.dialog.overlay, { $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); } - var $el = (this.oldInstances.length ? this.oldInstances.splice(0, 1)[0] : $('<div></div>').addClass('ui-widget-overlay')) - .appendTo(document.body) - .css({ - width: this.width(), - height: this.height() - }); + var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay')) + .appendTo(document.body) + .css({ + width: this.width(), + height: this.height() + }); ($.fn.bgiframe && $el.bgiframe()); @@ -644,7 +644,7 @@ $.extend($.ui.dialog.overlay, { }, destroy: function($el) { - this.oldInstances.push(this.instances.splice($.inArray(this.instances, $el), 1)[0]); + this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]); if (this.instances.length === 0) { $([document, window]).unbind('.dialog-overlay'); |