Skip to content

Commit c426b9a

Browse files
kdinevscottgonzalez
authored andcommitted
Resizable: Keep user-provided handles on destroy
Closes gh-1798 Ref gh-1795
1 parent c6e2b52 commit c426b9a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tests/unit/resizable/options.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,10 @@ QUnit.test( "zIndex, applied to all handles", function( assert ) {
434434
} );
435435

436436
QUnit.test( "setOption handles", function( assert ) {
437-
assert.expect( 15 );
437+
assert.expect( 19 );
438438

439+
// https://bugs.jqueryui.com/ticket/3423
440+
// https://bugs.jqueryui.com/ticket/15084
439441
var target = $( "<div></div>" ).resizable(),
440442
target2 = $( "<div>" +
441443
"<div class='ui-resizable-handle ui-resizable-e'></div>" +
@@ -470,6 +472,12 @@ QUnit.test( "setOption handles", function( assert ) {
470472

471473
target2.resizable( "option", "handles", "e, s, w" );
472474
checkHandles( target2, [ "e", "s", "w" ] );
475+
476+
target.resizable( "destroy" );
477+
checkHandles( target, [ ] );
478+
479+
target2.resizable( "destroy" );
480+
checkHandles( target2, [ "e", "w" ] );
473481
} );
474482

475483
QUnit.test( "alsoResize + containment", function( assert ) {

ui/widgets/resizable.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,14 @@ $.widget( "ui.resizable", $.ui.mouse, {
187187
_destroy: function() {
188188

189189
this._mouseDestroy();
190+
this._addedHandles.remove();
190191

191192
var wrapper,
192193
_destroy = function( exp ) {
193194
$( exp )
194195
.removeData( "resizable" )
195196
.removeData( "ui-resizable" )
196-
.off( ".resizable" )
197-
.find( ".ui-resizable-handle" )
198-
.remove();
197+
.off( ".resizable" );
199198
};
200199

201200
// TODO: Unwrap at same DOM position

0 commit comments

Comments
 (0)