JQuery Dialog - major slowdown when closing a modal dialog

JQuery Dialog - major slowdown when closing a modal dialog


There's a fairly major speed issue on the JQuery UI Dialog in RC6 when
in Modal mode.
The problem is that on a large page, the dialog can take many seconds
to close.
I traced the issue down to overlay.destroy(). In there, it's unbinding
events from every anchor and :input on the page. I traced the page and
found 99.9% of the processing on the dialog close handler is spent on
this line (606 of ui.dialog.js):
$('a, :input').add([document, window]).unbind('.dialog-overlay');
So the issue seems to be related to the workaround on the overlay that
basically binds the following events to every since anchor and :input
on the entire page (lines 557 - 578 of ui.dialog.js)
Events being bound to every anchor on the page (via dialog overlay):
"focus.dialog-overlay mousedown.dialog-overlay mouseup.dialog-overlay
keydown.dialog-overlay keypress.dialog-overlay click.dialog-overlay"
I believe a solution to this issue is to find another way to solve the
problem of preventing user interaction with the page without having to
bind to every since anchor. Seems that unbind is always going to be a
slow operation (since it has to do a ton of stuff), so the better
approach is to not bind so many potentially unneeded events.
Would love any help on getting this issue resolved. Several people are
currently reporting it currently on the ui jquery list. I'll submit a
proper Trac bug after I get some feedback from users and jquery dev's
about the issue.
Thanks