diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-08-06 13:28:25 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-08-06 13:28:25 -0400 |
commit | fb5cad37ceb37418d39e1dc1bacceb6ca6413563 (patch) | |
tree | 175ea4feab98e0b5c05bd7252cf5f446ff93f755 /ui | |
parent | 4d2ac1abca64ec19407f4a8217388223aea9cca4 (diff) | |
download | jquery-ui-fb5cad37ceb37418d39e1dc1bacceb6ca6413563.tar.gz jquery-ui-fb5cad37ceb37418d39e1dc1bacceb6ca6413563.zip |
Spinner: Don't clear invalid values on blur (but clear the value option).
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.spinner.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index a8f3a4fe9..baa3fb5cb 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -84,7 +84,13 @@ $.widget( "ui.spinner", { uiSpinner.addClass( "ui-state-active" ); }, blur: function( event ) { - this.value( this.element.val() ); + // don't clear invalid values on blur + var value = this.element.val(), + parsed = this._parse( value ); + this.option( "value", parsed ); + if ( parsed === null ) { + this.element.val( value ); + } // TODO: is this really correct or just the simplest // way to keep the active class when pressing the buttons? // if the mosue is over the text field and the user tabs out |