diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-20 11:06:11 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-20 11:06:11 -0400 |
commit | 308b55e50ca781ad9db08a252f313ee2e8e2f257 (patch) | |
tree | b287b6936d45efdfe067d2bdf4c732b13a1726bd /ui | |
parent | 2cf9948cadf45a24c591d6f7232f2470b4d9743e (diff) | |
parent | 33df9b788d3f60459c43acbfefdfeef8a07ce632 (diff) | |
download | jquery-ui-308b55e50ca781ad9db08a252f313ee2e8e2f257.tar.gz jquery-ui-308b55e50ca781ad9db08a252f313ee2e8e2f257.zip |
Merge branch 'master' into position-notification
Diffstat (limited to 'ui')
-rw-r--r-- | ui/i18n/jquery.ui.datepicker-hi.js | 18 | ||||
-rw-r--r-- | ui/jquery.effects.bounce.js | 16 | ||||
-rw-r--r-- | ui/jquery.effects.drop.js | 24 | ||||
-rw-r--r-- | ui/jquery.effects.fade.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.scale.js | 68 | ||||
-rw-r--r-- | ui/jquery.effects.slide.js | 20 | ||||
-rw-r--r-- | ui/jquery.ui.dialog.js | 14 | ||||
-rw-r--r-- | ui/jquery.ui.menu.js | 97 | ||||
-rw-r--r-- | ui/jquery.ui.resizable.js | 5 | ||||
-rw-r--r-- | ui/jquery.ui.sortable.js | 91 |
10 files changed, 175 insertions, 180 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-hi.js b/ui/i18n/jquery.ui.datepicker-hi.js index d75e98ead..edc530679 100644 --- a/ui/i18n/jquery.ui.datepicker-hi.js +++ b/ui/i18n/jquery.ui.datepicker-hi.js @@ -2,19 +2,19 @@ /* Written by Michael Dawart. */ jQuery(function($){ $.datepicker.regional['hi'] = { - closeText: 'होकर', - prevText: 'अगला', - nextText: 'नेक्स्ट', + closeText: 'बंद', + prevText: 'पिछला', + nextText: 'अगला', currentText: 'आज', - monthNames: ['जनवरी ','फरवरी','मार्च','अप्रेल','मै','जून', - 'जूलाई','अगस्त ','सितम्बर','आक्टोबर','नवम्बर','दिसम्बर'], - monthNamesShort: ['जन', 'फर', 'मार्च', 'अप्रेल', 'मै', 'जून', - 'जूलाई', 'अग', 'सित', 'आक्ट', 'नव', 'िद'], - dayNames: ['रविवासर', 'सोमवासर', 'मंगलवासर', 'बुधवासर', 'गुरुवासर', 'शुक्रवासर', 'शनिवासर'], + monthNames: ['जनवरी ','फरवरी','मार्च','अप्रेल','मई','जून', + 'जूलाई','अगस्त ','सितम्बर','अक्टूबर','नवम्बर','दिसम्बर'], + monthNamesShort: ['जन', 'फर', 'मार्च', 'अप्रेल', 'मई', 'जून', + 'जूलाई', 'अग', 'सित', अक्ट', 'नव', 'दि'], + dayNames: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार'], dayNamesShort: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'], dayNamesMin: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'], weekHeader: 'हफ्ता', - dateFormat: 'mm/dd/yy', + dateFormat: 'dd/mm/yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js index 94d73644e..934fb16ef 100644 --- a/ui/jquery.effects.bounce.js +++ b/ui/jquery.effects.bounce.js @@ -13,14 +13,14 @@ (function( $, undefined ) { $.effects.effect.bounce = function( o, done ) { - var el = $( this ), + var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], // defaults: mode = $.effects.setMode( el, o.mode || "effect" ), hide = mode === "hide", show = mode === "show", - direction = o.direction || "up", + direction = o.direction || "up", distance = o.distance, times = o.times || 5, @@ -31,7 +31,7 @@ $.effects.effect.bounce = function( o, done ) { // utility: ref = ( direction === "up" || direction === "down" ) ? "top" : "left", - motion = ( direction === "up" || direction === "left" ), + motion = ( direction === "up" || direction === "left" ), i, upAnim, downAnim, @@ -40,13 +40,13 @@ $.effects.effect.bounce = function( o, done ) { queue = el.queue(), queuelen = queue.length; - // Avoid touching opacity to prevent clearType and PNG issues in IE + // Avoid touching opacity to prevent clearType and PNG issues in IE if ( show || hide ) { props.push( "opacity" ); - } + } - $.effects.save( el, props ); - el.show(); + $.effects.save( el, props ); + el.show(); $.effects.createWrapper( el ); // Create Wrapper // default distance for the BIGGEST bounce is the outer Distance / 3 @@ -90,7 +90,7 @@ $.effects.effect.bounce = function( o, done ) { el.animate( upAnim, speed, easing ); } - + el.queue(function() { if ( hide ) { el.hide(); diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index 6c72be9e5..ea8d242d5 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -14,7 +14,7 @@ $.effects.effect.drop = function( o, done ) { - var el = $( this ), + var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], mode = $.effects.setMode( el, o.mode || "hide" ), show = mode === "show", @@ -27,9 +27,9 @@ $.effects.effect.drop = function( o, done ) { distance; // Adjust - $.effects.save( el, props ); - el.show(); - $.effects.createWrapper( el ); + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2; @@ -40,22 +40,22 @@ $.effects.effect.drop = function( o, done ) { } // Animation - animation[ ref ] = ( show ? - ( motion === "pos" ? "+=" : "-=" ) : + animation[ ref ] = ( show ? + ( motion === "pos" ? "+=" : "-=" ) : ( motion === "pos" ? "-=" : "+=" ) ) + distance; // Animate - el.animate( animation, { - queue: false, - duration: o.duration, - easing: o.easing, + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, complete: function() { if ( mode === "hide" ) { el.hide(); } - $.effects.restore( el, props ); - $.effects.removeWrapper( el ); + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); done(); } }); diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js index 89784bd08..66029b51c 100644 --- a/ui/jquery.effects.fade.js +++ b/ui/jquery.effects.fade.js @@ -18,7 +18,7 @@ $.effects.effect.fade = function( o, done ) { hide = mode === "hide"; el.show(); - el.animate({ + el.animate({ opacity: hide ? 0 : 1 }, { queue: false, diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 83b41d3c2..1eedb44eb 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -18,9 +18,9 @@ $.effects.effect.puff = function( o, done ) { hide = mode === "hide", percent = parseInt( o.percent, 10 ) || 150, factor = percent / 100, - original = { - height: elem.height(), - width: elem.width() + original = { + height: elem.height(), + width: elem.width() }; $.extend( o, { @@ -51,8 +51,8 @@ $.effects.effect.scale = function( o, done ) { ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), direction = o.direction || "both", origin = o.origin, - original = { - height: el.height(), + original = { + height: el.height(), width: el.width(), outerHeight: el.outerHeight(), outerWidth: el.outerWidth() @@ -60,7 +60,7 @@ $.effects.effect.scale = function( o, done ) { factor = { y: direction !== "horizontal" ? (percent / 100) : 1, x: direction !== "vertical" ? (percent / 100) : 1 - }; + }; // We are going to pass this effect to the size effect: options.effect = "size"; @@ -68,27 +68,27 @@ $.effects.effect.scale = function( o, done ) { options.complete = done; // Set default origin and restore for show/hide - if ( mode !== "effect" ) { + if ( mode !== "effect" ) { options.origin = origin || ["middle","center"]; options.restore = true; } - options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original ); + options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original ); options.to = { - height: original.height * factor.y, + height: original.height * factor.y, width: original.width * factor.x, - outerHeight: original.outerHeight * factor.y, + outerHeight: original.outerHeight * factor.y, outerWidth: original.outerWidth * factor.x - }; + }; // Fade option to support puff if ( options.fade ) { if ( mode === "show" ) { - options.from.opacity = 0; + options.from.opacity = 0; options.to.opacity = 1; } if ( mode === "hide" ) { - options.from.opacity = 1; + options.from.opacity = 1; options.to.opacity = 0; } } @@ -101,7 +101,7 @@ $.effects.effect.scale = function( o, done ) { $.effects.effect.size = function( o, done ) { // Create element - var el = $( this ), + var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], // Always restore @@ -125,7 +125,7 @@ $.effects.effect.size = function( o, done ) { el.show(); } original = { - height: el.height(), + height: el.height(), width: el.width(), outerHeight: el.outerHeight(), outerWidth: el.outerWidth() @@ -137,11 +137,11 @@ $.effects.effect.size = function( o, done ) { // Set scaling factor factor = { from: { - y: el.from.height / original.height, + y: el.from.height / original.height, x: el.from.width / original.width }, to: { - y: el.to.height / original.height, + y: el.to.height / original.height, x: el.to.width / original.width } }; @@ -150,14 +150,14 @@ $.effects.effect.size = function( o, done ) { if ( scale === "box" || scale === "both" ) { // Vertical props scaling - if ( factor.from.y !== factor.to.y ) { + if ( factor.from.y !== factor.to.y ) { props = props.concat( vProps ); el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); } // Horizontal props scaling - if ( factor.from.x !== factor.to.x ) { + if ( factor.from.x !== factor.to.x ) { props = props.concat( hProps ); el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); @@ -165,20 +165,20 @@ $.effects.effect.size = function( o, done ) { } // Scale the content - if ( scale === "content" || scale === "both" ) { + if ( scale === "content" || scale === "both" ) { // Vertical props scaling - if ( factor.from.y !== factor.to.y ) { + if ( factor.from.y !== factor.to.y ) { props = props.concat( cProps ); el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); } } - $.effects.save( el, restore ? props : props1 ); - el.show(); + $.effects.save( el, restore ? props : props1 ); + el.show(); $.effects.createWrapper( el ); - el.css( "overflow", "hidden" ).css( el.from ); + el.css( "overflow", "hidden" ).css( el.from ); // Adjust if (origin) { // Calculate baseline shifts @@ -200,8 +200,8 @@ $.effects.effect.size = function( o, done ) { el.find( "*[width]" ).each( function(){ var child = $( this ), - c_original = { - height: child.height(), + c_original = { + height: child.height(), width: child.width() }; if (restore) { @@ -209,16 +209,16 @@ $.effects.effect.size = function( o, done ) { } child.from = { - height: c_original.height * factor.from.y, + height: c_original.height * factor.from.y, width: c_original.width * factor.from.x }; child.to = { - height: c_original.height * factor.to.y, + height: c_original.height * factor.to.y, width: c_original.width * factor.to.x }; // Vertical props scaling - if ( factor.from.y !== factor.to.y ) { + if ( factor.from.y !== factor.to.y ) { child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); } @@ -242,10 +242,10 @@ $.effects.effect.size = function( o, done ) { } // Animate - el.animate( el.to, { - queue: false, - duration: o.duration, - easing: o.easing, + el.animate( el.to, { + queue: false, + duration: o.duration, + easing: o.easing, complete: function() { if ( el.to.opacity === 0 ) { el.css( "opacity", el.from.opacity ); @@ -277,7 +277,7 @@ $.effects.effect.size = function( o, done ) { return toRef + "px"; } - return val + toRef + "px"; + return val + toRef + "px"; }); }); } diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index 77d540a9c..e57a21264 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -29,32 +29,32 @@ $.effects.effect.slide = function( o, done ) { // Adjust $.effects.save( el, props ); el.show(); - distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]({ + distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]({ margin: true }); - + $.effects.createWrapper( el ).css({ overflow: "hidden" }); - + if ( show ) { el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); } // Animation - animation[ ref ] = ( show ? - ( positiveMotion ? "+=" : "-=") : + animation[ ref ] = ( show ? + ( positiveMotion ? "+=" : "-=") : ( positiveMotion ? "-=" : "+=")) + distance; // Animate - el.animate( animation, { - queue: false, - duration: o.duration, - easing: o.easing, + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, complete: function() { if ( mode === "hide" ) { - el.hide(); + el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 3a9bd5dc6..144cf9725 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -77,10 +77,10 @@ $.widget("ui.dialog", { // #5742 - .attr() might return a DOMElement if ( typeof this.originalTitle !== "string" ) { this.originalTitle = ""; - } - this.oldPosition = { - parent: this.element.parent(), - index: this.element.parent().children().index( this.element ) + } + this.oldPosition = { + parent: this.element.parent(), + index: this.element.parent().children().index( this.element ) }; this.options.title = this.options.title || this.originalTitle; var self = this, @@ -171,7 +171,7 @@ $.widget("ui.dialog", { }, _destroy: function() { - var self = this, next, + var self = this, next, oldPosition = this.oldPosition; if ( self.overlay ) { @@ -187,13 +187,13 @@ $.widget("ui.dialog", { if ( self.originalTitle ) { self.element.attr( "title", self.originalTitle ); } - + next = oldPosition.parent.children().eq( oldPosition.index ); if ( next.length ) { next.before( self.element ); } else { oldPosition.parent.append( self.element ); - } + } }, widget: function() { diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 6982da3c3..bcefd5822 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -13,7 +13,8 @@ */ (function($) { -var idIncrement = 0; +var idIncrement = 0, + currentEventTarget = null; $.widget( "ui.menu", { version: "@VERSION", @@ -53,7 +54,9 @@ $.widget( "ui.menu", { }, this )); if ( this.options.disabled ) { - this.element.addClass( "ui-state-disabled" ); + this.element + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); } this._bind({ @@ -66,20 +69,25 @@ $.widget( "ui.menu", { event.preventDefault(); }, "click .ui-menu-item:has(a)": function( event ) { - event.stopImmediatePropagation(); - // Don't select disabled menu items - if ( !$( event.target ).closest( ".ui-menu-item" ).is( ".ui-state-disabled" ) ) { - this.select( event ); - // Redirect focus to the menu with a delay for firefox - this._delay(function() { - if ( !this.element.is(":focus") ) { - this.element.focus(); - } - }, 20 ); + var target = $( event.target ); + if ( target[0] !== currentEventTarget ) { + currentEventTarget = target[0]; + target.one( "click.menu", function( event ) { + currentEventTarget = null; + }); + // Don't select disabled menu items + if ( !target.closest( ".ui-menu-item" ).is( ".ui-state-disabled" ) ) { + this.select( event ); + // Redirect focus to the menu with a delay for firefox + this._delay(function() { + if ( !this.element.is(":focus") ) { + this.element.focus(); + } + }, 20 ); + } } }, - "mouseover .ui-menu-item": function( event ) { - event.stopImmediatePropagation(); + "mouseenter .ui-menu-item": function( event ) { var target = $( event.currentTarget ); // Remove ui-state-active class from siblings of the newly focused menu item // to avoid a jump caused by adjacent elements both having a class with a border @@ -90,7 +98,7 @@ $.widget( "ui.menu", { "mouseleave .ui-menu": "collapseAll", "focus": function( event ) { var menu = this.element, - firstItem = menu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 ); + firstItem = menu.children( ".ui-menu-item" ).eq( 0 ); if ( this._hasScroll() && !this.active ) { menu.children().each(function() { var currentItem = $( this ); @@ -151,6 +159,9 @@ $.widget( "ui.menu", { .removeAttr( "id" ) .children( ".ui-icon" ) .remove(); + + // unbind currentEventTarget click event handler + $( currentEventTarget ).unbind( "click.menu" ); }, _keydown: function( event ) { @@ -158,65 +169,52 @@ $.widget( "ui.menu", { case $.ui.keyCode.PAGE_UP: this.previousPage( event ); event.preventDefault(); - event.stopImmediatePropagation(); break; case $.ui.keyCode.PAGE_DOWN: this.nextPage( event ); event.preventDefault(); - event.stopImmediatePropagation(); break; case $.ui.keyCode.HOME: this._move( "first", "first", event ); event.preventDefault(); - event.stopImmediatePropagation(); break; case $.ui.keyCode.END: this._move( "last", "last", event ); event.preventDefault(); - event.stopImmediatePropagation(); break; case $.ui.keyCode.UP: this.previous( event ); event.preventDefault(); - event.stopImmediatePropagation(); break; case $.ui.keyCode.DOWN: this.next( event ); event.preventDefault(); - event.stopImmediatePropagation(); break; case $.ui.keyCode.LEFT: - if (this.collapse( event )) { - event.stopImmediatePropagation(); - } + this.collapse( event ); event.preventDefault(); break; case $.ui.keyCode.RIGHT: - if (this.expand( event )) { - event.stopImmediatePropagation(); + if ( !this.active.is( ".ui-state-disabled" ) ) { + this.expand( event ); } event.preventDefault(); break; case $.ui.keyCode.ENTER: - if ( this.active.children( "a[aria-haspopup='true']" ).length ) { - if ( this.expand( event ) ) { - event.stopImmediatePropagation(); + if ( !this.active.is( ".ui-state-disabled" ) ) { + if ( this.active.children( "a[aria-haspopup='true']" ).length ) { + this.expand( event ); + } else { + this.select( event ); } } - else { - this.select( event ); - event.stopImmediatePropagation(); - } event.preventDefault(); break; case $.ui.keyCode.ESCAPE: - if ( this.collapse( event ) ) { - event.stopImmediatePropagation(); - } + this.collapse( event ); event.preventDefault(); break; default: - event.stopPropagation(); clearTimeout( this.filterTimer ); var match, prev = this.previousFilter || "", @@ -291,6 +289,9 @@ $.widget( "ui.menu", { // initialize unlinked menu-items as dividers menus.children( ":not(.ui-menu-item)" ).addClass( "ui-widget-content ui-menu-divider" ); + // add aria-disabled attribute to any disabled menu item + menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); + submenus.each(function() { var menu = $( this ), item = menu.prev( "a" ); @@ -303,7 +304,7 @@ $.widget( "ui.menu", { focus: function( event, item ) { var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; - this.blur( event ); + this.blur( event, event && event.type === "focus" ); if ( this._hasScroll() ) { borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; @@ -342,8 +343,10 @@ $.widget( "ui.menu", { this._trigger( "focus", event, { item: item } ); }, - blur: function( event ) { - clearTimeout( this.timer ); + blur: function( event, fromFocus ) { + if ( !fromFocus ) { + clearTimeout( this.timer ); + } if ( !this.active ) { return; @@ -441,7 +444,6 @@ $.widget( "ui.menu", { this.active .children( ".ui-menu " ) .children( ".ui-menu-item" ) - .not( ".ui-state-disabled" ) .first(); if ( newItem && newItem.length ) { @@ -477,12 +479,10 @@ $.widget( "ui.menu", { if ( direction === "first" || direction === "last" ) { next = this.active [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) - .not( ".ui-state-disabled" ) .eq( -1 ); } else { next = this.active [ direction + "All" ]( ".ui-menu-item" ) - .not( ".ui-state-disabled" ) .eq( 0 ); } } @@ -491,9 +491,6 @@ $.widget( "ui.menu", { } this.focus( event, next ); - if ( next.is( ".ui-state-disabled" ) ) { - this._move( direction, filter, event ); - } }, nextPage: function( event ) { @@ -508,14 +505,14 @@ $.widget( "ui.menu", { var base = this.active.offset().top, height = this.element.height(), result; - this.active.nextAll( ".ui-menu-item" ).not( ".ui-state-disabled" ).each(function() { + this.active.nextAll( ".ui-menu-item" ).each(function() { result = $( this ); return $( this ).offset().top - base - height < 0; }); this.focus( event, result ); } else { - this.focus( event, this.activeMenu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ) + this.focus( event, this.activeMenu.children( ".ui-menu-item" ) [ !this.active ? "first" : "last" ]() ); } }, @@ -532,14 +529,14 @@ $.widget( "ui.menu", { var base = this.active.offset().top, height = this.element.height(), result; - this.active.prevAll( ".ui-menu-item" ).not( ".ui-state-disabled" ).each(function() { + this.active.prevAll( ".ui-menu-item" ).each(function() { result = $( this ); return $(this).offset().top - base + height > 0; }); this.focus( event, result ); } else { - this.focus( event, this.activeMenu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).first() ); + this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() ); } }, diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 9be33927e..c00602cc8 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -99,9 +99,8 @@ $.widget("ui.resizable", $.ui.mouse, { var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>'); - // increase zIndex of sw, se, ne, nw axis - //TODO : this modifies original option - if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex }); + // Apply zIndex to all handles - see #7960 + axis.css({ zIndex: o.zIndex }); //TODO : What's going on here? if ('se' == handle) { diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 4093be245..5373967df 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -59,7 +59,7 @@ $.widget("ui.sortable", $.ui.mouse, { //Initialize mouse events for interaction this._mouseInit(); - + //We're ready to go this.ready = true @@ -79,7 +79,7 @@ $.widget("ui.sortable", $.ui.mouse, { _setOption: function(key, value){ if ( key === "disabled" ) { this.options[ key ] = value; - + this.widget().toggleClass( "ui-sortable-disabled", !!value ); } else { // Don't call widget base _setOption for disable as it adds ui-state-disabled class @@ -519,7 +519,7 @@ $.widget("ui.sortable", $.ui.mouse, { ? [options.connectWith] : options.connectWith; }, - + _getItemsAsjQuery: function(connected) { var self = this; @@ -673,9 +673,8 @@ $.widget("ui.sortable", $.ui.mouse, { // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified if(className && !o.forcePlaceholderSize) return; - //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item - if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; - if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; + p.height(self.currentItem.height()); + p.width(self.currentItem.width()); } }; } @@ -692,28 +691,28 @@ $.widget("ui.sortable", $.ui.mouse, { }, _contactContainers: function(event) { - - // get innermost container that intersects with item - var innermostContainer = null, innermostIndex = null; - - + + // get innermost container that intersects with item + var innermostContainer = null, innermostIndex = null; + + for (var i = this.containers.length - 1; i >= 0; i--){ - // never consider a container that's located within the item itself + // never consider a container that's located within the item itself if($.contains(this.currentItem[0], this.containers[i].element[0])) continue; if(this._intersectsWith(this.containers[i].containerCache)) { - // if we've already found a container and it's more "inner" than this, then continue + // if we've already found a container and it's more "inner" than this, then continue if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) continue; - innermostContainer = this.containers[i]; + innermostContainer = this.containers[i]; innermostIndex = i; - + } else { - // container doesn't intersect. trigger "out" event if necessary + // container doesn't intersect. trigger "out" event if necessary if(this.containers[i].containerCache.over) { this.containers[i]._trigger("out", event, this._uiHash(this)); this.containers[i].containerCache.over = 0; @@ -721,42 +720,42 @@ $.widget("ui.sortable", $.ui.mouse, { } } - - // if no intersecting containers found, return - if(!innermostContainer) return; + + // if no intersecting containers found, return + if(!innermostContainer) return; // move the item into the container if it's not there already if(this.containers.length === 1) { this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); this.containers[innermostIndex].containerCache.over = 1; - } else if(this.currentContainer != this.containers[innermostIndex]) { - - //When entering a new container, we will find the item with the least distance and append our item near it - var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; - for (var j = this.items.length - 1; j >= 0; j--) { - if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; - var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; - if(Math.abs(cur - base) < dist) { - dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; - } - } - - if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled - return; - - this.currentContainer = this.containers[innermostIndex]; - itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); - this._trigger("change", event, this._uiHash()); - this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); - - //Update the placeholder - this.options.placeholder.update(this.currentContainer, this.placeholder); - - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + } else if(this.currentContainer != this.containers[innermostIndex]) { + + //When entering a new container, we will find the item with the least distance and append our item near it + var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; + for (var j = this.items.length - 1; j >= 0; j--) { + if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; + var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; + if(Math.abs(cur - base) < dist) { + dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; + } + } + + if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled + return; + + this.currentContainer = this.containers[innermostIndex]; + itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); + this._trigger("change", event, this._uiHash()); + this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); + + //Update the placeholder + this.options.placeholder.update(this.currentContainer, this.placeholder); + + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); this.containers[innermostIndex].containerCache.over = 1; - } - - + } + + }, _createHelper: function(event) { |