Skip to content

Commit ec5f395

Browse files
dekajpmikesherov
authored andcommitted
Resizable: modified to allow resizing when resizables are nested.
Fixes #5025 Closes jquerygh-1149
1 parent dfff034 commit ec5f395

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

tests/unit/resizable/resizable_core.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,37 @@ test( "resizable stores correct size when using helper and grid (#9547)", functi
206206
equal( target.height(), 100, "compare height" );
207207
});
208208

209+
test( "nested resizable", function() {
210+
expect( 4 );
211+
212+
var outer = $( "<div id='outer' style='width:50px'></div>" ),
213+
inner = $( "<div id='inner' style='width:30px'></div>" ),
214+
target = $( "#resizable1" ),
215+
innerHandle,
216+
outerHandle;
217+
218+
outer.appendTo( target );
219+
inner.appendTo( outer );
220+
221+
inner.resizable( { handles : "e" } );
222+
outer.resizable( { handles : "e" } );
223+
target.resizable( { handles : "e" } );
224+
225+
innerHandle = $( "#inner > .ui-resizable-e" );
226+
outerHandle = $( "#outer > .ui-resizable-e" );
227+
228+
TestHelpers.resizable.drag( innerHandle, 10 );
229+
equal( inner.width(), 40, "compare width of inner element" );
230+
TestHelpers.resizable.drag( innerHandle, -10 );
231+
equal( inner.width(), 30, "compare width of inner element" );
232+
233+
TestHelpers.resizable.drag( outerHandle, 10 );
234+
equal( outer.width(), 60, "compare width of outer element" );
235+
TestHelpers.resizable.drag( outerHandle, -10 );
236+
equal( outer.width(), 50, "compare width of outer element" );
237+
238+
inner.remove();
239+
outer.remove();
240+
});
241+
209242
})(jQuery);

ui/jquery.ui.resizable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ $.widget("ui.resizable", $.ui.mouse, {
169169
for(i in this.handles) {
170170

171171
if(this.handles[i].constructor === String) {
172-
this.handles[i] = $(this.handles[i], this.element).show();
172+
this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
173173
}
174174

175175
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)

0 commit comments

Comments
 (0)