diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-07-25 11:53:14 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-07-25 11:53:14 -0400 |
commit | 19a9de7e668cdb3b76c3b733d0147f1853cb38a5 (patch) | |
tree | a259b421dd77cbec27e55db9b4d1104bf5214a2a /ui/jquery.ui.spinner.js | |
parent | daadc343be2f139e82719e2e5ff466aa19ec166f (diff) | |
parent | 51ee3be39829e339c8e4bccb532347944e600ca5 (diff) | |
download | jquery-ui-19a9de7e668cdb3b76c3b733d0147f1853cb38a5.tar.gz jquery-ui-19a9de7e668cdb3b76c3b733d0147f1853cb38a5.zip |
Merge branch 'master' into core-1.6.1
Conflicts:
demos/menubar/default.html
tests/unit/autocomplete/autocomplete.html
tests/visual/effects/effects.all.html
ui/jquery.ui.menu.js
ui/jquery.ui.popup.js
Diffstat (limited to 'ui/jquery.ui.spinner.js')
-rw-r--r-- | ui/jquery.ui.spinner.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 87da9ac05..b03c59709 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -258,12 +258,29 @@ $.widget( "ui.spinner", { : 2 : 1); + // clamp the new value + newVal = this._trimValue( newVal ); + if ( this._trigger( "spin", event, { value: newVal } ) !== false) { this.value( newVal ); this.counter++; } }, + _trimValue: function( value ) { + var options = this.options; + + if ( value > options.max) { + return options.max; + } + + if ( value < options.min ) { + return options.min; + } + + return value; + }, + _stop: function( event ) { this.counter = 0; if ( this.timer ) { @@ -280,13 +297,7 @@ $.widget( "ui.spinner", { _setOption: function( key, value ) { if ( key === "value") { - value = this._parse( value ); - if ( value < this.options.min ) { - value = this.options.min; - } - if ( value > this.options.max ) { - value = this.options.max; - } + value = this._trimValue( this._parse(value) ); } if ( key === "disabled" ) { |