]> source.dussan.org Git - jquery-ui.git/commitdiff
Spinner: Fixed double firing of change event when setting the value option directly.
authorScott González <scott.gonzalez@gmail.com>
Sun, 7 Aug 2011 16:38:01 +0000 (12:38 -0400)
committerScott González <scott.gonzalez@gmail.com>
Sun, 7 Aug 2011 16:38:01 +0000 (12:38 -0400)
demos/spinner/default.html
ui/jquery.ui.spinner.js

index 35445a0e132b77427ce0c672bc530c9444c627f2..53fd81bf5cb1295fa2c52803feb7f79ea8b1bc44 100644 (file)
@@ -6,6 +6,7 @@
        <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
        <script type="text/javascript" src="../../jquery-1.6.2.js"></script>
        <script type="text/javascript" src="../../external/jquery.mousewheel-3.0.4.js"></script>
+       <script type="text/javascript" src="../../external/jquery.global.js"></script>
        <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
        <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
        <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
        <link type="text/css" href="../demos.css" rel="stylesheet" />
        <script type="text/javascript">
        $(function() {
-               $("#spinner").spinner();
+               $("#spinner").spinner({
+                       change: function() {
+                               console.log( "change" );
+                       }
+               });
                
                $("#disable").toggle(function() {
                        $("#spinner").spinner("disable");
index 6004f0bc6af412f00e6bf8925d12921246bd5519..71f6a2332393c1c440868c363a45ffb959609439 100644 (file)
@@ -287,7 +287,7 @@ $.widget( "ui.spinner", {
 
        _setOption: function( key, value ) {
                if ( key === "value" ) {
-                       return this._setOptionValue( value );
+                       return this._value( value );
                }
 
                this._super( "_setOption", key, value );
@@ -303,14 +303,6 @@ $.widget( "ui.spinner", {
                }
        },
 
-       _setOptionValue: function( value ) {
-               var previous = this.options.value;
-               this._value( value );
-               if ( previous !== this.options.value ) {
-                       this._trigger( "change" );
-               }
-       },
-
        _setOptions: modifier(function( options ) {
                this._super( "_setOptions", options );
 
@@ -342,6 +334,7 @@ $.widget( "ui.spinner", {
        _value: function( value ) {
                this.options.value = this._trimValue( this._parse(value) );
                this._format();
+               this._aria();
        },
 
        destroy: function() {