diff options
Diffstat (limited to 'ui/widgets/sortable.js')
-rw-r--r-- | ui/widgets/sortable.js | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/ui/widgets/sortable.js b/ui/widgets/sortable.js index b7daf00bf..f44b4832a 100644 --- a/ui/widgets/sortable.js +++ b/ui/widgets/sortable.js @@ -15,6 +15,8 @@ //>>css.structure: ../../themes/base/sortable.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -32,7 +34,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; return $.widget( "ui.sortable", $.ui.mouse, { version: "@VERSION", @@ -239,7 +242,9 @@ return $.widget( "ui.sortable", $.ui.mouse, { this.cssPosition = this.helper.css( "position" ); //Adjust the mouse offset relative to the helper if "cursorAt" is supplied - ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); + if ( o.cursorAt ) { + this._adjustOffsetFromHelper( o.cursorAt ); + } //Cache the former DOM position this.domPosition = { @@ -695,8 +700,8 @@ return $.widget( "ui.sortable", $.ui.mouse, { horizontalDirection = this.dragDirection.horizontal; return this.floating ? - ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) - : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); + ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : + ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); }, @@ -1093,9 +1098,11 @@ return $.widget( "ui.sortable", $.ui.mouse, { return; } - itemWithLeastDistance ? - this._rearrange( event, itemWithLeastDistance, null, true ) : + if ( itemWithLeastDistance ) { + this._rearrange( event, itemWithLeastDistance, null, true ); + } else { this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); + } this._trigger( "change", event, this._uiHash() ); this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); this.currentContainer = this.containers[ innermostIndex ]; @@ -1435,9 +1442,12 @@ return $.widget( "ui.sortable", $.ui.mouse, { _rearrange: function( event, i, a, hardRefresh ) { - a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) : + if ( a ) { + a[ 0 ].appendChild( this.placeholder[ 0 ] ); + } else { i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); + } //Various things done here to improve the performance: // 1. we create a setTimeout, that calls refreshPositions @@ -1603,4 +1613,4 @@ return $.widget( "ui.sortable", $.ui.mouse, { } ); -} ) ); +} ); |