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 | |
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')
-rw-r--r-- | ui/widgets/accordion.js | 11 | ||||
-rw-r--r-- | ui/widgets/autocomplete.js | 9 | ||||
-rw-r--r-- | ui/widgets/button.js | 7 | ||||
-rw-r--r-- | ui/widgets/checkboxradio.js | 7 | ||||
-rw-r--r-- | ui/widgets/controlgroup.js | 8 | ||||
-rw-r--r-- | ui/widgets/datepicker.js | 55 | ||||
-rw-r--r-- | ui/widgets/dialog.js | 7 | ||||
-rw-r--r-- | ui/widgets/draggable.js | 25 | ||||
-rw-r--r-- | ui/widgets/droppable.js | 14 | ||||
-rw-r--r-- | ui/widgets/menu.js | 7 | ||||
-rw-r--r-- | ui/widgets/mouse.js | 21 | ||||
-rw-r--r-- | ui/widgets/progressbar.js | 11 | ||||
-rw-r--r-- | ui/widgets/resizable.js | 27 | ||||
-rw-r--r-- | ui/widgets/selectable.js | 15 | ||||
-rw-r--r-- | ui/widgets/selectmenu.js | 11 | ||||
-rw-r--r-- | ui/widgets/slider.js | 7 | ||||
-rw-r--r-- | ui/widgets/sortable.js | 26 | ||||
-rw-r--r-- | ui/widgets/spinner.js | 7 | ||||
-rw-r--r-- | ui/widgets/tabs.js | 7 | ||||
-rw-r--r-- | ui/widgets/tooltip.js | 7 |
20 files changed, 199 insertions, 90 deletions
diff --git a/ui/widgets/accordion.js b/ui/widgets/accordion.js index 59a6a7315..112781925 100644 --- a/ui/widgets/accordion.js +++ b/ui/widgets/accordion.js @@ -9,9 +9,9 @@ //>>label: Accordion //>>group: Widgets -// jscs:disable maximumLineLength +/* eslint-disable max-len */ //>>description: Displays collapsible content panels for presenting information in a limited amount of space. -// jscs:enable maximumLineLength +/* eslint-enable max-len */ //>>docs: http://api.jqueryui.com/accordion/ //>>demos: http://jqueryui.com/accordion/ //>>css.structure: ../../themes/base/core.css @@ -19,6 +19,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -34,7 +36,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; return $.widget( "ui.accordion", { version: "@VERSION", @@ -616,4 +619,4 @@ return $.widget( "ui.accordion", { } } ); -} ) ); +} ); diff --git a/ui/widgets/autocomplete.js b/ui/widgets/autocomplete.js index 66756820b..4166029b2 100644 --- a/ui/widgets/autocomplete.js +++ b/ui/widgets/autocomplete.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -34,7 +36,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.autocomplete", { version: "@VERSION", @@ -616,7 +619,7 @@ $.widget( "ui.autocomplete", { var editable = element.prop( "contentEditable" ); if ( editable === "inherit" ) { - return this._isContentEditable( element.parent() ); + return this._isContentEditable( element.parent() ); } return editable === "true"; @@ -667,4 +670,4 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, { return $.ui.autocomplete; -} ) ); +} ); diff --git a/ui/widgets/button.js b/ui/widgets/button.js index a4be3c76e..c7cbb4f04 100644 --- a/ui/widgets/button.js +++ b/ui/widgets/button.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -36,7 +38,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.button", { version: "@VERSION", @@ -443,4 +446,4 @@ if ( $.uiBackCompat !== false ) { return $.ui.button; -} ) ); +} ); diff --git a/ui/widgets/checkboxradio.js b/ui/widgets/checkboxradio.js index 0cb1a0cf8..b2537d292 100644 --- a/ui/widgets/checkboxradio.js +++ b/ui/widgets/checkboxradio.js @@ -18,6 +18,8 @@ //>>css.theme: ../../themes/base/theme.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"; $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { version: "@VERSION", @@ -279,4 +282,4 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { return $.ui.checkboxradio; -} ) ); +} ); diff --git a/ui/widgets/controlgroup.js b/ui/widgets/controlgroup.js index 019abbec9..77a9e2265 100644 --- a/ui/widgets/controlgroup.js +++ b/ui/widgets/controlgroup.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -29,7 +31,9 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; + var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; return $.widget( "ui.controlgroup", { @@ -295,4 +299,4 @@ return $.widget( "ui.controlgroup", { } } } ); -} ) ); +} ); diff --git a/ui/widgets/datepicker.js b/ui/widgets/datepicker.js index d363c8fc6..7dbcf3de7 100644 --- a/ui/widgets/datepicker.js +++ b/ui/widgets/datepicker.js @@ -1,5 +1,4 @@ -// jscs:disable maximumLineLength -/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ +/* eslint-disable max-len, camelcase */ /*! * jQuery UI Datepicker @VERSION * http://jqueryui.com @@ -19,6 +18,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -32,7 +33,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.extend( $.ui, { datepicker: { version: "@VERSION" } } ); @@ -62,6 +64,7 @@ function datepicker_getZindex( elem ) { return 0; } + /* Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, @@ -88,12 +91,12 @@ function Datepicker() { prevText: "Prev", // Display text for previous month link nextText: "Next", // Display text for next month link currentText: "Today", // Display text for current month link - monthNames: [ "January","February","March","April","May","June", - "July","August","September","October","November","December" ], // Names of months for drop-down and formatting + monthNames: [ "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting - dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday + dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday weekHeader: "Wk", // Column header for week of the year dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... @@ -161,6 +164,7 @@ function Datepicker() { } $.extend( Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ markerClassName: "hasDatepicker", @@ -453,7 +457,9 @@ $.extend( Datepicker.prototype, { if ( nodeName === "input" ) { target.disabled = false; inst.trigger.filter( "button" ). - each( function() { this.disabled = false; } ).end(). + each( function() { + this.disabled = false; + } ).end(). filter( "img" ).css( { opacity: "1.0", cursor: "" } ); } else if ( nodeName === "div" || nodeName === "span" ) { inline = $target.children( "." + this._inlineClass ); @@ -462,7 +468,11 @@ $.extend( Datepicker.prototype, { prop( "disabled", false ); } this._disabledInputs = $.map( this._disabledInputs, - function( value ) { return ( value === target ? null : value ); } ); // delete entry + + // Delete entry + function( value ) { + return ( value === target ? null : value ); + } ); }, /* Disable the date picker to a jQuery selection. @@ -481,7 +491,9 @@ $.extend( Datepicker.prototype, { if ( nodeName === "input" ) { target.disabled = true; inst.trigger.filter( "button" ). - each( function() { this.disabled = true; } ).end(). + each( function() { + this.disabled = true; + } ).end(). filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); } else if ( nodeName === "div" || nodeName === "span" ) { inline = $target.children( "." + this._inlineClass ); @@ -490,7 +502,11 @@ $.extend( Datepicker.prototype, { prop( "disabled", true ); } this._disabledInputs = $.map( this._disabledInputs, - function( value ) { return ( value === target ? null : value ); } ); // delete entry + + // Delete entry + function( value ) { + return ( value === target ? null : value ); + } ); this._disabledInputs[ this._disabledInputs.length ] = target; }, @@ -518,8 +534,7 @@ $.extend( Datepicker.prototype, { _getInst: function( target ) { try { return $.data( target, "datepicker" ); - } - catch ( err ) { + } catch ( err ) { throw "Missing instance data for this datepicker"; } }, @@ -752,8 +767,7 @@ $.extend( Datepicker.prototype, { $.datepicker._updateAlternate( inst ); $.datepicker._updateDatepicker( inst ); } - } - catch ( err ) { + } catch ( err ) { } } return true; @@ -1558,8 +1572,7 @@ $.extend( Datepicker.prototype, { try { return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), offset, $.datepicker._getFormatConfig( inst ) ); - } - catch ( e ) { + } catch ( e ) { // Ignore } @@ -2207,10 +2220,12 @@ $.fn.datepicker = function( options ) { apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); } return this.each( function() { - typeof options === "string" ? - $.datepicker[ "_" + options + "Datepicker" ]. - apply( $.datepicker, [ this ].concat( otherArgs ) ) : + if ( typeof options === "string" ) { + $.datepicker[ "_" + options + "Datepicker" ] + .apply( $.datepicker, [ this ].concat( otherArgs ) ); + } else { $.datepicker._attachDatepicker( this, options ); + } } ); }; @@ -2221,4 +2236,4 @@ $.datepicker.version = "@VERSION"; return $.datepicker; -} ) ); +} ); diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js index dcb4f7056..6fa585c40 100644 --- a/ui/widgets/dialog.js +++ b/ui/widgets/dialog.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -41,7 +43,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.dialog", { version: "@VERSION", @@ -948,4 +951,4 @@ if ( $.uiBackCompat !== false ) { return $.ui.dialog; -} ) ); +} ); diff --git a/ui/widgets/draggable.js b/ui/widgets/draggable.js index 5f41d2408..2a9666d4e 100644 --- a/ui/widgets/draggable.js +++ b/ui/widgets/draggable.js @@ -15,6 +15,8 @@ //>>css.structure: ../../themes/base/draggable.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -34,7 +36,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.draggable", $.ui.mouse, { version: "@VERSION", @@ -201,7 +204,9 @@ $.widget( "ui.draggable", $.ui.mouse, { this.originalPageY = event.pageY; //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 ); + } //Set a containment if given in the options this._setContainment(); @@ -1116,12 +1121,13 @@ $.ui.plugin.add( "draggable", "snap", { !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) { if ( inst.snapElements[ i ].snapping ) { - ( inst.options.snap.release && + if ( inst.options.snap.release ) { inst.options.snap.release.call( inst.element, event, $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) - ) ); + ); + } } inst.snapElements[ i ].snapping = false; continue; @@ -1192,13 +1198,14 @@ $.ui.plugin.add( "draggable", "snap", { } if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { - ( inst.options.snap.snap && + if ( inst.options.snap.snap ) { inst.options.snap.snap.call( inst.element, event, $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item - } ) ) ); + } ) ); + } } inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); @@ -1216,7 +1223,9 @@ $.ui.plugin.add( "draggable", "stack", { ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); } ); - if ( !group.length ) { return; } + if ( !group.length ) { + return; + } min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; $( group ).each( function( i ) { @@ -1247,4 +1256,4 @@ $.ui.plugin.add( "draggable", "zIndex", { return $.ui.draggable; -} ) ); +} ); diff --git a/ui/widgets/droppable.js b/ui/widgets/droppable.js index f98ff2714..01de767b4 100644 --- a/ui/widgets/droppable.js +++ b/ui/widgets/droppable.js @@ -14,6 +14,8 @@ //>>demos: http://jqueryui.com/droppable/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -29,7 +31,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.droppable", { version: "@VERSION", @@ -80,7 +83,9 @@ $.widget( "ui.droppable", { this._addToManager( o.scope ); - o.addClasses && this._addClass( "ui-droppable" ); + if ( o.addClasses ) { + this._addClass( "ui-droppable" ); + } }, @@ -206,7 +211,8 @@ $.widget( "ui.droppable", { ) ) { childrenIntersection = true; - return false; } + return false; + } } ); if ( childrenIntersection ) { return false; @@ -494,4 +500,4 @@ if ( $.uiBackCompat !== false ) { return $.ui.droppable; -} ) ); +} ); diff --git a/ui/widgets/menu.js b/ui/widgets/menu.js index 3b17112f8..2bc37789b 100644 --- a/ui/widgets/menu.js +++ b/ui/widgets/menu.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -34,7 +36,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; return $.widget( "ui.menu", { version: "@VERSION", @@ -707,4 +710,4 @@ return $.widget( "ui.menu", { } } ); -} ) ); +} ); diff --git a/ui/widgets/mouse.js b/ui/widgets/mouse.js index 0ae8979a1..1efcf08db 100644 --- a/ui/widgets/mouse.js +++ b/ui/widgets/mouse.js @@ -13,6 +13,8 @@ //>>docs: http://api.jqueryui.com/mouse/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -27,7 +29,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; var mouseHandled = false; $( document ).on( "mouseup", function() { @@ -80,7 +83,9 @@ return $.widget( "ui.mouse", { this._mouseMoved = false; // We may have missed mouseup (out of window) - ( this._mouseStarted && this._mouseUp( event ) ); + if ( this._mouseStarted ) { + this._mouseUp( event ); + } this._mouseDownEvent = event; @@ -173,7 +178,11 @@ return $.widget( "ui.mouse", { if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { this._mouseStarted = ( this._mouseStart( this._mouseDownEvent, event ) !== false ); - ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) ); + if ( this._mouseStarted ) { + this._mouseDrag( event ); + } else { + this._mouseUp( event ); + } } return !this._mouseStarted; @@ -220,7 +229,9 @@ return $.widget( "ui.mouse", { _mouseStart: function( /* event */ ) {}, _mouseDrag: function( /* event */ ) {}, _mouseStop: function( /* event */ ) {}, - _mouseCapture: function( /* event */ ) { return true; } + _mouseCapture: function( /* event */ ) { + return true; + } } ); -} ) ); +} ); diff --git a/ui/widgets/progressbar.js b/ui/widgets/progressbar.js index dd7ee3143..e39bc2fcb 100644 --- a/ui/widgets/progressbar.js +++ b/ui/widgets/progressbar.js @@ -9,9 +9,9 @@ //>>label: Progressbar //>>group: Widgets -// jscs:disable maximumLineLength +/* eslint-disable max-len */ //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. -// jscs:enable maximumLineLength +/* eslint-enable max-len */ //>>docs: http://api.jqueryui.com/progressbar/ //>>demos: http://jqueryui.com/progressbar/ //>>css.structure: ../../themes/base/core.css @@ -19,6 +19,8 @@ //>>css.theme: ../../themes/base/theme.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.progressbar", { version: "@VERSION", @@ -175,4 +178,4 @@ return $.widget( "ui.progressbar", { } } ); -} ) ); +} ); diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 222c93a5e..13e98c658 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -33,7 +35,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.resizable", $.ui.mouse, { version: "@VERSION", @@ -91,9 +94,15 @@ $.widget( "ui.resizable", $.ui.mouse, { // TODO: determine which cases actually cause this to happen // if the element doesn't have the scroll set, see if it's possible to // set the scroll - el[ scroll ] = 1; - has = ( el[ scroll ] > 0 ); - el[ scroll ] = 0; + try { + el[ scroll ] = 1; + has = ( el[ scroll ] > 0 ); + el[ scroll ] = 0; + } catch ( e ) { + + // `el` might be a string, then setting `scroll` will throw + // an error in strict mode; ignore it. + } return has; }, @@ -776,7 +785,9 @@ $.widget( "ui.resizable", $.ui.mouse, { _propagate: function( n, event ) { $.ui.plugin.call( this, n, [ event, this.ui() ] ); - ( n !== "resize" && this._trigger( n, event, this.ui() ) ); + if ( n !== "resize" ) { + this._trigger( n, event, this.ui() ); + } }, plugins: {}, @@ -897,8 +908,8 @@ $.ui.plugin.add( "resizable", "containment", { co = that.containerOffset; ch = that.containerSize.height; cw = that.containerSize.width; - width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw ); - height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ; + width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); + height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); that.parentData = { element: ce, @@ -1205,4 +1216,4 @@ $.ui.plugin.add( "resizable", "grid", { return $.ui.resizable; -} ) ); +} ); diff --git a/ui/widgets/selectable.js b/ui/widgets/selectable.js index ed980cc49..b8e29517c 100644 --- a/ui/widgets/selectable.js +++ b/ui/widgets/selectable.js @@ -15,6 +15,8 @@ //>>css.structure: ../../themes/base/selectable.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -29,7 +31,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; return $.widget( "ui.selectable", $.ui.mouse, { version: "@VERSION", @@ -183,8 +186,12 @@ return $.widget( "ui.selectable", $.ui.mouse, { x2 = event.pageX, y2 = event.pageY; - if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; } - if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; } + if ( x1 > x2 ) { + tmp = x2; x2 = x1; x1 = tmp; + } + if ( y1 > y2 ) { + tmp = y2; y2 = y1; y1 = tmp; + } this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); this.selectees.each( function() { @@ -307,4 +314,4 @@ return $.widget( "ui.selectable", $.ui.mouse, { } ); -} ) ); +} ); diff --git a/ui/widgets/selectmenu.js b/ui/widgets/selectmenu.js index cc98ecbbf..cefeddcac 100644 --- a/ui/widgets/selectmenu.js +++ b/ui/widgets/selectmenu.js @@ -9,9 +9,9 @@ //>>label: Selectmenu //>>group: Widgets -// jscs:disable maximumLineLength +/* eslint-disable max-len */ //>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select. -// jscs:enable maximumLineLength +/* eslint-enable max-len */ //>>docs: http://api.jqueryui.com/selectmenu/ //>>demos: http://jqueryui.com/selectmenu/ //>>css.structure: ../../themes/base/core.css @@ -19,6 +19,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -38,7 +40,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { version: "@VERSION", @@ -687,4 +690,4 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { } } ] ); -} ) ); +} ); diff --git a/ui/widgets/slider.js b/ui/widgets/slider.js index e5004573a..ec2c2877e 100644 --- a/ui/widgets/slider.js +++ b/ui/widgets/slider.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.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.slider", $.ui.mouse, { version: "@VERSION", @@ -749,4 +752,4 @@ return $.widget( "ui.slider", $.ui.mouse, { } } ); -} ) ); +} ); 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, { } ); -} ) ); +} ); diff --git a/ui/widgets/spinner.js b/ui/widgets/spinner.js index 6b860e785..1bd69b6d8 100644 --- a/ui/widgets/spinner.js +++ b/ui/widgets/spinner.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -33,7 +35,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; function spinnerModifier( fn ) { return function() { @@ -576,4 +579,4 @@ if ( $.uiBackCompat !== false ) { return $.ui.spinner; -} ) ); +} ); diff --git a/ui/widgets/tabs.js b/ui/widgets/tabs.js index 7a53767dd..9e4236ab3 100644 --- a/ui/widgets/tabs.js +++ b/ui/widgets/tabs.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -33,7 +35,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.tabs", { version: "@VERSION", @@ -919,4 +922,4 @@ if ( $.uiBackCompat !== false ) { return $.ui.tabs; -} ) ); +} ); diff --git a/ui/widgets/tooltip.js b/ui/widgets/tooltip.js index cd031ceb2..f1cea47d1 100644 --- a/ui/widgets/tooltip.js +++ b/ui/widgets/tooltip.js @@ -17,6 +17,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -33,7 +35,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.tooltip", { version: "@VERSION", @@ -518,4 +521,4 @@ if ( $.uiBackCompat !== false ) { return $.ui.tooltip; -} ) ); +} ); |