r2104 - trunk/ui

r2104 - trunk/ui


Author: scott.gonzalez
Date: Wed Feb 18 18:07:05 2009
New Revision: 2104
Modified:
trunk/ui/ui.dialog.js
Log:
Dialog: Use event delegation to cancel events for modal dialogs. Fixes
#2807 - dialogUI + modal mode = slow.
Modified: trunk/ui/ui.dialog.js
==============================================================================
--- trunk/ui/ui.dialog.js    (original)
+++ trunk/ui/ui.dialog.js    Wed Feb 18 18:07:05 2009
@@ -524,7 +524,7 @@
            // we use a setTimeout in case the overlay is created from an
            // event that we're going to be cancelling (see #2804)
            setTimeout(function() {
-                $('a, :input').bind($.ui.dialog.overlay.events, function() {
+                $(document).bind($.ui.dialog.overlay.events, function() {
                    // allow use of the element if inside a dialog and
                    // - there are no modal dialogs
                    // - there are modal dialogs, but we are in front of the topmost modal
@@ -572,7 +572,7 @@
        this.instances.splice($.inArray(this.instances, $el), 1);
        if (this.instances.length === 0) {
-            $('a, :input').add([document, window]).unbind('.dialog-overlay');
+            $([document, window]).unbind('.dialog-overlay');
        }
        $el.remove();