diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/jquery/ui/spinner.js --- a/wp/wp-includes/js/jquery/ui/spinner.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/jquery/ui/spinner.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,5 +1,5 @@ /*! - * jQuery UI Spinner 1.12.1 + * jQuery UI Spinner 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -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. @@ -30,9 +32,10 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; -function spinnerModifer( fn ) { +function spinnerModifier( fn ) { return function() { var previous = this.element.val(); fn.apply( this, arguments ); @@ -44,7 +47,7 @@ } $.widget( "ui.spinner", { - version: "1.12.1", + version: "1.13.1", defaultElement: "", widgetEventPrefix: "spin", options: { @@ -137,9 +140,13 @@ } }, mousewheel: function( event, delta ) { - if ( !delta ) { + var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ); + var isActive = this.element[ 0 ] === activeElement; + + if ( !isActive || !delta ) { return; } + if ( !this.spinning && !this._start( event ) ) { return false; } @@ -227,10 +234,10 @@ .wrap( "" ) .parent() - // Add buttons - .append( - "" - ); + // Add buttons + .append( + "" + ); }, _draw: function() { @@ -268,7 +275,7 @@ // IE 6 doesn't understand height: 50% for the buttons // unless the wrapper has an explicit height if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && - this.uiSpinner.height() > 0 ) { + this.uiSpinner.height() > 0 ) { this.uiSpinner.height( this.uiSpinner.height() ); } }, @@ -278,18 +285,18 @@ keyCode = $.ui.keyCode; switch ( event.keyCode ) { - case keyCode.UP: - this._repeat( null, 1, event ); - return true; - case keyCode.DOWN: - this._repeat( null, -1, event ); - return true; - case keyCode.PAGE_UP: - this._repeat( null, options.page, event ); - return true; - case keyCode.PAGE_DOWN: - this._repeat( null, -options.page, event ); - return true; + case keyCode.UP: + this._repeat( null, 1, event ); + return true; + case keyCode.DOWN: + this._repeat( null, -1, event ); + return true; + case keyCode.PAGE_UP: + this._repeat( null, options.page, event ); + return true; + case keyCode.PAGE_DOWN: + this._repeat( null, -options.page, event ); + return true; } return false; @@ -337,7 +344,7 @@ var incremental = this.options.incremental; if ( incremental ) { - return $.isFunction( incremental ) ? + return typeof incremental === "function" ? incremental( i ) : Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); } @@ -435,7 +442,7 @@ this.buttons.button( value ? "disable" : "enable" ); }, - _setOptions: spinnerModifer( function( options ) { + _setOptions: spinnerModifier( function( options ) { this._super( options ); } ), @@ -502,7 +509,7 @@ this.uiSpinner.replaceWith( this.element ); }, - stepUp: spinnerModifer( function( steps ) { + stepUp: spinnerModifier( function( steps ) { this._stepUp( steps ); } ), _stepUp: function( steps ) { @@ -512,7 +519,7 @@ } }, - stepDown: spinnerModifer( function( steps ) { + stepDown: spinnerModifier( function( steps ) { this._stepDown( steps ); } ), _stepDown: function( steps ) { @@ -522,11 +529,11 @@ } }, - pageUp: spinnerModifer( function( pages ) { + pageUp: spinnerModifier( function( pages ) { this._stepUp( ( pages || 1 ) * this.options.page ); } ), - pageDown: spinnerModifer( function( pages ) { + pageDown: spinnerModifier( function( pages ) { this._stepDown( ( pages || 1 ) * this.options.page ); } ), @@ -534,7 +541,7 @@ if ( !arguments.length ) { return this._parse( this.element.val() ); } - spinnerModifer( this._value ).call( this, newVal ); + spinnerModifier( this._value ).call( this, newVal ); }, widget: function() { @@ -554,8 +561,8 @@ .wrap( this._uiSpinnerHtml() ) .parent() - // Add buttons - .append( this._buttonHtml() ); + // Add buttons + .append( this._buttonHtml() ); }, _uiSpinnerHtml: function() { return ""; @@ -569,4 +576,4 @@ return $.ui.spinner; -} ) ); +} );