diff options
Diffstat (limited to 'ui/jquery.ui.spinner.js')
-rw-r--r-- | ui/jquery.ui.spinner.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 7fc291c00..b78b4dbea 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -53,7 +53,7 @@ $.widget( "ui.spinner", { // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete // if the page is unloaded before the widget is destroyed. #7790 - this._bind( this.element[0].ownerDocument.defaultView, { + this._bind( this.window, { beforeunload: function() { this.element.removeAttr( "autocomplete" ); } @@ -112,7 +112,7 @@ $.widget( "ui.spinner", { "mousedown .ui-spinner-button": function( event ) { // ensure focus is on (or stays on) the text field event.preventDefault(); - if ( document.activeElement !== this.element[ 0 ] ) { + if ( this.document[0].activeElement !== this.element[ 0 ] ) { this.element.focus(); } @@ -311,7 +311,14 @@ $.widget( "ui.spinner", { }, _setOption: function( key, value ) { - this._super( "_setOption", key, value ); + if ( key === "culture" || key === "numberFormat" ) { + var prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + this._super( key, value ); if ( key === "disabled" ) { if ( value ) { @@ -325,7 +332,7 @@ $.widget( "ui.spinner", { }, _setOptions: modifier(function( options ) { - this._super( "_setOptions", options ); + this._super( options ); this._value( this.element.val() ); }), @@ -380,7 +387,7 @@ $.widget( "ui.spinner", { .removeAttr( "aria-valuemin" ) .removeAttr( "aria-valuemax" ) .removeAttr( "aria-valuenow" ); - this._super( "destroy" ); + this._super(); this.uiSpinner.replaceWith( this.element ); }, |