r2395 - Dialog: Don't bind overlay event handlers if the overlays are destroyed before the setTim...
Author: scott.gonzalez
Date: Sat Mar 28 09:33:59 2009
New Revision: 2395
Modified:
trunk/ui/ui.dialog.js
Log:
Dialog: Don't bind overlay event handlers if the overlays are destroyed
before the setTimeout block is executed - Fixes #4065 - modal dialog +
button locks page.
Modified: trunk/ui/ui.dialog.js
==============================================================================
--- trunk/ui/ui.dialog.js (original)
+++ trunk/ui/ui.dialog.js Sat Mar 28 09:33:59 2009
@@ -533,10 +533,13 @@
// we use a setTimeout in case the overlay is created from an
// event that we're going to be cancelling (see #2804)
setTimeout(function() {
- $(document).bind($.ui.dialog.overlay.events, function(event) {
- var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') ||
0;
- return (dialogZ > $.ui.dialog.overlay.maxZ);
- });
+ // handle $(el).dialog().dialog('close') (see #4065)
+ if ($.ui.dialog.overlay.instances.length) {
+ $(document).bind($.ui.dialog.overlay.events, function(event) {
+ var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') ||
0;
+ return (dialogZ > $.ui.dialog.overlay.maxZ);
+ });
+ }
}, 1);
// allow closing by pressing the escape key