]> source.dussan.org Git - jquery-ui.git/commitdiff
Resizable: Keep user-provided handles on destroy
authorKonstantin Dinev <kdinev@mail.bw.edu>
Tue, 28 Feb 2017 16:21:46 +0000 (18:21 +0200)
committerScott González <scott.gonzalez@gmail.com>
Mon, 17 Apr 2017 18:58:12 +0000 (14:58 -0400)
Closes gh-1798
Ref gh-1795

tests/unit/resizable/options.js
ui/widgets/resizable.js

index 4080bac0e73afd73f86f687d8fc574c3c559f5fd..81206abf8e8d503cee6cd1caf1c65099e7bf9a81 100644 (file)
@@ -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>" +
@@ -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 ) {
index b5264ee532196929b81f5f2fe3fd3864ef047c52..36dd1251403f857c698913e8d47662a8f31609b1 100644 (file)
@@ -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