From ec5f395260c5e4b678d2fe39c5405d466ee8369e Mon Sep 17 00:00:00 2001 From: Jyoti Deka Date: Sat, 7 Dec 2013 01:39:34 -0500 Subject: [PATCH] Resizable: modified to allow resizing when resizables are nested. Fixes #5025 Closes gh-1149 --- tests/unit/resizable/resizable_core.js | 33 ++++++++++++++++++++++++++ ui/jquery.ui.resizable.js | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js index b02e8b4f1..f0b5cea20 100644 --- a/tests/unit/resizable/resizable_core.js +++ b/tests/unit/resizable/resizable_core.js @@ -206,4 +206,37 @@ test( "resizable stores correct size when using helper and grid (#9547)", functi equal( target.height(), 100, "compare height" ); }); +test( "nested resizable", function() { + expect( 4 ); + + var outer = $( "
" ), + inner = $( "
" ), + target = $( "#resizable1" ), + innerHandle, + outerHandle; + + outer.appendTo( target ); + inner.appendTo( outer ); + + inner.resizable( { handles : "e" } ); + outer.resizable( { handles : "e" } ); + target.resizable( { handles : "e" } ); + + innerHandle = $( "#inner > .ui-resizable-e" ); + outerHandle = $( "#outer > .ui-resizable-e" ); + + TestHelpers.resizable.drag( innerHandle, 10 ); + equal( inner.width(), 40, "compare width of inner element" ); + TestHelpers.resizable.drag( innerHandle, -10 ); + equal( inner.width(), 30, "compare width of inner element" ); + + TestHelpers.resizable.drag( outerHandle, 10 ); + equal( outer.width(), 60, "compare width of outer element" ); + TestHelpers.resizable.drag( outerHandle, -10 ); + equal( outer.width(), 50, "compare width of outer element" ); + + inner.remove(); + outer.remove(); +}); + })(jQuery); diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 040f029f9..dc14a53a6 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -169,7 +169,7 @@ $.widget("ui.resizable", $.ui.mouse, { for(i in this.handles) { if(this.handles[i].constructor === String) { - this.handles[i] = $(this.handles[i], this.element).show(); + this.handles[i] = this.element.children( this.handles[ i ] ).first().show(); } //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) -- 2.39.5