Skip to content

Commit

Permalink
Resizable: Made handles work with complex markup. Fixes #8756 - Resiz…
Browse files Browse the repository at this point in the history
…able: Complex markup for handles.
  • Loading branch information
MatteS75 authored and scottgonzalez committed Nov 5, 2012
1 parent 6874f19 commit 0bff32a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
20 changes: 20 additions & 0 deletions tests/unit/resizable/resizable_core.js
Expand Up @@ -129,4 +129,24 @@ 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" );
});

})(jQuery);
9 changes: 5 additions & 4 deletions ui/jquery.ui.resizable.js
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

0 comments on commit 0bff32a

Please sign in to comment.