Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resizable: Updating destroy to keep user handles
  • Loading branch information
Konstantin Dinev committed Feb 28, 2017
commit e47dbbc7565712fe08c05b79f04ffdde86988000
10 changes: 9 additions & 1 deletion tests/unit/resizable/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,10 @@ QUnit.test( "zIndex, applied to all handles", function( assert ) {
} );

QUnit.test( "setOption handles", function( assert ) {
assert.expect( 15 );
assert.expect( 19 );

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

target2.resizable( "option", "handles", "e, s, w" );
checkHandles( target2, [ "e", "s", "w" ] );

target.resizable( "destroy" );
checkHandles( target, [ ] );

target2.resizable( "destroy" );
checkHandles( target2, [ "e", "w" ] );
} );

QUnit.test( "alsoResize + containment", function( assert ) {
Expand Down
5 changes: 2 additions & 3 deletions ui/widgets/resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,14 @@ $.widget( "ui.resizable", $.ui.mouse, {
_destroy: function() {

this._mouseDestroy();
this._addedHandles.remove();

var wrapper,
_destroy = function( exp ) {
$( exp )
.removeData( "resizable" )
.removeData( "ui-resizable" )
.off( ".resizable" )
.find( ".ui-resizable-handle" )
.remove();
.off( ".resizable" );
};

// TODO: Unwrap at same DOM position
Expand Down