Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions tests/unit/resizable/resizable.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ui/jquery.ui.core.js",
"ui/jquery.ui.widget.js",
"ui/jquery.ui.mouse.js",
"ui/jquery.ui.draggable.js",
"ui/jquery.ui.resizable.js"
]
});
Expand Down
40 changes: 40 additions & 0 deletions tests/unit/resizable/resizable_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,44 @@ test("nw", function() {
equal( target.height(), 100, "compare height" );
});

test("handle with complex markup (#8756)", function() {
expect(2);

$('#resizable1')
.append(
$('<div>')
.addClass("ui-resizable-handle")
.addClass("ui-resizable-w")
.append($('<div>'))
);

var handle = '.ui-resizable-w div', target = $('#resizable1').resizable({ handles: 'all' });

TestHelpers.resizable.drag(handle, -50);
equal( target.width(), 150, "compare width" );

TestHelpers.resizable.drag(handle, 50);
equal( target.width(), 100, "compare width" );
});

test("handle with complex markup, and draggable (#8757)", function() {
expect(2);

$('#resizable1')
.append(
$('<div>')
.addClass("ui-resizable-handle")
.addClass("ui-resizable-w")
.append($('<div>'))
);

var handle = '.ui-resizable-w div', target = $('#resizable1').draggable().resizable({ handles: 'all' });

TestHelpers.resizable.drag(handle, -50);
equal( target.width(), 150, "compare width" );

TestHelpers.resizable.drag(handle, 50);
equal( target.width(), 100, "compare width" );
});

})(jQuery);
2 changes: 1 addition & 1 deletion ui/jquery.ui.draggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $.widget("ui.draggable", $.ui.mouse, {
var o = this.options;

// among others, prevent a drag on a resizable-handle
if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle') || $(event.target).closest('.ui-resizable-handle').length > 0)
return false;

//Quit if we're not on a valid handle
Expand Down
9 changes: 5 additions & 4 deletions ui/jquery.ui.resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,15 @@ $.widget("ui.resizable", $.ui.mouse, {
},

_mouseCapture: function(event) {
var handle = false;
var capture = false;
for (var i in this.handles) {
if ($(this.handles[i])[0] == event.target) {
handle = true;
var handle = $(this.handles[i])[0];
if (handle == event.target || $.contains(handle, event.target)) {
capture = true;
}
}

return !this.options.disabled && handle;
return !this.options.disabled && capture;
},

_mouseStart: function(event) {
Expand Down