diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index 255c988879f..5ac643bbf6b 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -57,6 +57,7 @@

I'm a resizable.
+
solid gray diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index 89504e36366..76fa7e40277 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -236,6 +236,20 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 equal( target.height(), 100, "compare maxHeight" ); }); + +test("custom handles { handles: { 's': $('#resizer1'), containment: 'parent' }", function () { + expect(2); + + var handle = "#resizer1", target = $("#resizable1").resizable({ handles: { "s": $("#resizer1") }, containment: "parent" }); + + TestHelpers.resizable.drag(handle, 0, 70); + equal(target.height(), 170, "compare height"); + + TestHelpers.resizable.drag(handle, 0, -70); + equal(target.height(), 100, "compare height"); +}); + + test("zIndex, applied to all handles", function() { expect(8); diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 040f029f968..574efcce14a 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -201,9 +201,14 @@ $.widget("ui.resizable", $.ui.mouse, { //TODO: make renderAxis a prototype function this._renderAxis(this.element); - - this._handles = $(".ui-resizable-handle", this.element) - .disableSelection(); + + this._handles = $(".ui-resizable-handle", this.element); + + //Add the custom handles of jquery Objects outside this.element + for (i in this.handles) { + this._handles = this._handles.add(this.handles[i]); + } + this._handles.disableSelection(); //Matching axis name this._handles.mouseover(function() { @@ -242,6 +247,19 @@ $.widget("ui.resizable", $.ui.mouse, { //Initialize the mouse interaction this._mouseInit(); + //Bind the mousedown event directly in the custom jquery elements + if (o.handles.constructor !== String) { + for (i in o.handles) { + handle = o.handles[i]; + if (handle instanceof $) { + handle.bind("mousedown." + this.widgetName, onMouseDownCustom); + } + } + } + + function onMouseDownCustom(event) { + return that._mouseDown(event); + } }, _destroy: function() {