Skip to content

Commit 13505e5

Browse files
committed
Dialog: Ensure all animations finish and clean up themselve when destroying dialog. Fixes #5860 - Dialog: Destroying a dialog during animated close leaves .ui-effects-wrapper in DOM.
1 parent 548a6ce commit 13505e5

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

tests/unit/dialog/dialog.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"ui/jquery.ui.draggable.js",
2424
"ui/jquery.ui.resizable.js",
2525
"ui/jquery.ui.button.js",
26+
"ui/jquery.ui.effect.js",
27+
"ui/jquery.ui.effect-clip.js",
2628
"ui/jquery.ui.dialog.js"
2729
]
2830
});

tests/unit/dialog/dialog_options.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,15 @@ test("height", function() {
212212
el.remove();
213213
});
214214

215+
asyncTest( "hide, #5860 - don't leave effects wrapper behind", function() {
216+
expect( 1 );
217+
$( "#dialog1" ).dialog({ hide: "clip" }).dialog( "close" ).dialog( "destroy" );
218+
setTimeout(function() {
219+
equal( $( ".ui-effects-wrapper" ).length, 0 );
220+
start();
221+
}, 500);
222+
});
223+
215224
test("maxHeight", function() {
216225
expect(3);
217226

ui/jquery.ui.dialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ $.widget("ui.dialog", {
131131
// without detaching first, the following becomes really slow
132132
.detach();
133133

134-
this.uiDialog.remove();
134+
this.uiDialog.stop( true, true ).remove();
135135

136136
if ( this.originalTitle ) {
137137
this.element.attr( "title", this.originalTitle );

0 commit comments

Comments
 (0)