]> source.dussan.org Git - jquery-ui.git/commitdiff
Spinner: Use _getCreateOptions() for value.
authorScott González <scott.gonzalez@gmail.com>
Sun, 7 Aug 2011 12:20:14 +0000 (08:20 -0400)
committerScott González <scott.gonzalez@gmail.com>
Sun, 7 Aug 2011 12:20:14 +0000 (08:20 -0400)
tests/unit/spinner/spinner_defaults.js
ui/jquery.ui.spinner.js

index 3a62876187803a14f61b02c7d315944ee3e6a713..18949ff903d1a2f3300d7cfeacbaf30f5c72367d 100644 (file)
@@ -7,7 +7,7 @@ commonWidgetTests( "spinner", {
                numberFormat: null,
                page: 10,
                step: 1,
-               value: null,
+               value: 0,
 
                // callbacks
                change: null,
index a207a8aed253d5dc405175aa635be03f7c452155..138d32f0a9e73615028459c84e41d00fdb031fcb 100644 (file)
@@ -24,7 +24,7 @@ $.widget( "ui.spinner", {
                numberFormat: null,
                page: 10,
                step: 1,
-               value: null,
+               value: 0,
 
                change: null,
                spin: null,
@@ -33,7 +33,7 @@ $.widget( "ui.spinner", {
        },
 
        _create: function() {
-               this.value( this.options.value !== null ? this.options.value : this.element.val() || 0 );
+               this.value( this.options.value );
                this._draw();
                this._mousewheel();
                this._aria();
@@ -43,9 +43,9 @@ $.widget( "ui.spinner", {
                var options = {},
                        element = this.element;
 
-               $.each( [ "min", "max", "step" ], function( i, option ) {
+               $.each( [ "min", "max", "step", "value" ], function( i, option ) {
                        var value = element.attr( option );
-                       if ( value !== undefined ) {
+                       if ( value !== undefined && value.length ) {
                                options[ option ] = value;
                        }
                });