diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-03-28 16:33:59 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-03-28 16:33:59 +0000 |
commit | a39d0d9350dc8589c61a793bb5aca4916406d737 (patch) | |
tree | 35976c250bb324fcdd039698d6f3c8def2d5f31c /ui/ui.dialog.js | |
parent | 12b47dc1ea6dfa8c21d2705d02332646e4ff5770 (diff) | |
download | jquery-ui-a39d0d9350dc8589c61a793bb5aca4916406d737.tar.gz jquery-ui-a39d0d9350dc8589c61a793bb5aca4916406d737.zip |
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.
Diffstat (limited to 'ui/ui.dialog.js')
-rw-r--r-- | ui/ui.dialog.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 553a6748d..cbd0b107c 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -533,10 +533,13 @@ $.extend($.ui.dialog.overlay, { // 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 |