]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Improve _destroy method, detaching dialog content from wrapper instead of...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 17 Nov 2012 12:14:04 +0000 (13:14 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 26 Nov 2012 09:28:24 +0000 (10:28 +0100)
ui/jquery.ui.dialog.js

index 15e19d7cfb52bf7afaf22a041575b7a50a0c8dad..b998c2558e19e504b75a6dc602c232e3cb17a887 100644 (file)
@@ -123,20 +123,20 @@ $.widget("ui.dialog", {
                        oldPosition = this.oldPosition;
 
                this._destroyOverlay();
-               this.uiDialog.hide();
+
                this.element
                        .removeUniqueId()
                        .removeClass( "ui-dialog-content ui-widget-content" )
                        .hide()
-                       // TODO restore old position directly, instead of appending to body first
-                       .appendTo( "body" );
+                       // without detaching first, the following becomes really slow
+                       .detach();
+
                this.uiDialog.remove();
 
                if ( this.originalTitle ) {
                        this.element.attr( "title", this.originalTitle );
                }
 
-               // TODO do this before removing the wrapper
                next = oldPosition.parent.children().eq( oldPosition.index );
                // Don't try to place the dialog next to itself (#8613)
                if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {