diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-08-06 20:08:50 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-08-06 20:08:50 -0400 |
commit | e9cdd576f4327f947b00032b6d1aaa60c305c844 (patch) | |
tree | 4bcce6c0807d96cb2a93bb0d62460292abaae40f /ui | |
parent | e4898fdfc6877648d8d95b2a87cb022890c8bcca (diff) | |
parent | e4c0f202c8f29a8038d9f37615a787c61bc57262 (diff) | |
download | jquery-ui-e9cdd576f4327f947b00032b6d1aaa60c305c844.tar.gz jquery-ui-e9cdd576f4327f947b00032b6d1aaa60c305c844.zip |
Merge branch 'spinner-getCreateOptions'
Conflicts:
ui/jquery.ui.spinner.js
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.spinner.js | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 49bbc7bf2..a207a8aed 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -19,11 +19,11 @@ $.widget( "ui.spinner", { widgetEventPrefix: "spin", options: { incremental: true, - max: null, - min: null, + max: Number.MAX_VALUE, + min: -Number.MAX_VALUE, numberFormat: null, page: 10, - step: null, + step: 1, value: null, change: null, @@ -33,31 +33,24 @@ $.widget( "ui.spinner", { }, _create: function() { - this._markupOptions(); + this.value( this.options.value !== null ? this.options.value : this.element.val() || 0 ); this._draw(); this._mousewheel(); this._aria(); }, - // TODO: should we use _getCreateOptions() now? - // would increase overhead of init when options are specified, - // but would move the defaults to the right location - // and use our API the way it's meant to be used - _markupOptions: function() { - var that = this; - $.each({ - min: -Number.MAX_VALUE, - max: Number.MAX_VALUE, - step: 1 - }, function( attr, defaultValue ) { - if ( that.options[ attr ] === null ) { - var value = that.element.attr( attr ); - that.options[ attr ] = typeof value === "string" && value.length > 0 ? - that._parse( value ) : - defaultValue; + _getCreateOptions: function() { + var options = {}, + element = this.element; + + $.each( [ "min", "max", "step" ], function( i, option ) { + var value = element.attr( option ); + if ( value !== undefined ) { + options[ option ] = value; } }); - this.value( this.options.value !== null ? this.options.value : this.element.val() || 0 ); + + return options; }, _draw: function() { |