aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.spinner.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-06-19 14:45:20 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-06-19 14:45:20 +0200
commitaa7f8195f8c288dbefcb92064b68cb28064ac64c (patch)
tree333cd184f8a830c1b588e3d3d0368c134648a3b6 /ui/jquery.ui.spinner.js
parent391282a9aeb4e5bb6ba6655d7f1d5d125f93155a (diff)
parentfb210ae1ec16cefb1e4d4dfaf7d55499cac53ab8 (diff)
downloadjquery-ui-aa7f8195f8c288dbefcb92064b68cb28064ac64c.tar.gz
jquery-ui-aa7f8195f8c288dbefcb92064b68cb28064ac64c.zip
Merge branch 'master' into widget-delegation
Diffstat (limited to 'ui/jquery.ui.spinner.js')
-rw-r--r--ui/jquery.ui.spinner.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index b4cefc982..951b336ed 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" ) {