diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2021-06-07 00:58:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 00:58:12 +0200 |
commit | 70dae67b73dfea9126f126f516fe8286f1e73417 (patch) | |
tree | e61eafab41ee74330fecf1da2ce125050cfac49b /ui/widgets/sortable.js | |
parent | a12c98574d07f002fd59d166f9fc1fd391581b91 (diff) | |
download | jquery-ui-70dae67b73dfea9126f126f516fe8286f1e73417.tar.gz jquery-ui-70dae67b73dfea9126f126f516fe8286f1e73417.zip |
Build: Migrate from JSHint & JSCS to ESLint
Fixes #15393
Closes gh-1958
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, { } ); -} ) ); +} ); |