Skip to content

Commit 0bff32a

Browse files
MatteS75scottgonzalez
authored andcommitted
Resizable: Made handles work with complex markup. Fixes #8756 - Resizable: Complex markup for handles.
1 parent 6874f19 commit 0bff32a

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

tests/unit/resizable/resizable_core.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,24 @@ test("nw", function() {
129129
equal( target.height(), 100, "compare height" );
130130
});
131131

132+
test("handle with complex markup (#8756)", function() {
133+
expect(2);
134+
135+
$('#resizable1')
136+
.append(
137+
$('<div>')
138+
.addClass("ui-resizable-handle")
139+
.addClass("ui-resizable-w")
140+
.append($('<div>'))
141+
);
142+
143+
var handle = '.ui-resizable-w div', target = $('#resizable1').resizable({ handles: 'all' });
144+
145+
TestHelpers.resizable.drag(handle, -50);
146+
equal( target.width(), 150, "compare width" );
147+
148+
TestHelpers.resizable.drag(handle, 50);
149+
equal( target.width(), 100, "compare width" );
150+
});
151+
132152
})(jQuery);

ui/jquery.ui.resizable.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,15 @@ $.widget("ui.resizable", $.ui.mouse, {
231231
},
232232

233233
_mouseCapture: function(event) {
234-
var handle = false;
234+
var capture = false;
235235
for (var i in this.handles) {
236-
if ($(this.handles[i])[0] == event.target) {
237-
handle = true;
236+
var handle = $(this.handles[i])[0];
237+
if (handle == event.target || $.contains(handle, event.target)) {
238+
capture = true;
238239
}
239240
}
240241

241-
return !this.options.disabled && handle;
242+
return !this.options.disabled && capture;
242243
},
243244

244245
_mouseStart: function(event) {

0 commit comments

Comments
 (0)