]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: made handles work with complex markup. Fixes #8757 - Draggable: Resizable...
authormathias.stenbom <mathias@stenbom.com>
Mon, 19 Nov 2012 14:06:36 +0000 (09:06 -0500)
committerMike Sherov <mike.sherov@gmail.com>
Mon, 19 Nov 2012 14:06:50 +0000 (09:06 -0500)
tests/unit/draggable/draggable.html
tests/unit/draggable/draggable_core.js
ui/jquery.ui.draggable.js

index dce226a9ae5717fbe3292b10fc0ea005cf82ef81..cd068eb2086c69e4ac38a91bce3efc694c69b886 100644 (file)
@@ -16,6 +16,7 @@
                        "ui/jquery.ui.core.js",
                        "ui/jquery.ui.widget.js",
                        "ui/jquery.ui.mouse.js",
+                       "ui/jquery.ui.resizable.js",
                        "ui/jquery.ui.draggable.js"
                ]
        });
index 31002addcfd1fbdec20c5cb915b52b59209b944d..28a19f3805eedd6c5cc84771ecac5966a8adcf0a 100644 (file)
@@ -44,4 +44,33 @@ test("No options, absolute", function() {
        TestHelpers.draggable.shouldMove(el);
 });
 
+test("resizable handle with complex markup (#8756 / #8757)", function() {
+       expect( 2 );
+
+       $('#draggable1')
+               .append(
+                       $('<div>')
+                               .addClass("ui-resizable-handle")
+                               .addClass("ui-resizable-w")
+                               .append($('<div>'))
+               );
+
+       var handle = '.ui-resizable-w div',
+               target = $('#draggable1').draggable().resizable({ handles: 'all' }),
+               drag = function(el, dx) {
+                       $(el)
+                               .simulate("mouseover")
+                               .simulate("drag", {
+                                       dx: dx || 0,
+                                       speed: 'sync'
+                               });
+               };
+
+       drag(handle, -50);
+       equal( target.width(), 250, "compare width" );
+
+       drag(handle, 50);
+       equal( target.width(), 200, "compare width" );
+});
+
 })(jQuery);
index dad5af074517f1e94eca0c1cd2cad4b88439804f..b982ac6be3242cfb6f4911c645b0a750c2d826bd 100644 (file)
@@ -70,7 +70,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).closest('.ui-resizable-handle').length > 0) {
                        return false;
                }