diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-11-18 17:13:28 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-11-18 17:13:28 +0100 |
commit | d6e4d4705d3d3be01ab92ea4f07a52a59ba10b5a (patch) | |
tree | 185bf6282643a667a1e69837b106249156f71952 /ui/jquery.ui.spinner.js | |
parent | 26603de5bafb4fe9e824b28d8f799ed0f7e0604f (diff) | |
parent | 66f9e12797c16d8fa9078f45401f08f0f200e1bc (diff) | |
download | jquery-ui-d6e4d4705d3d3be01ab92ea4f07a52a59ba10b5a.tar.gz jquery-ui-d6e4d4705d3d3be01ab92ea4f07a52a59ba10b5a.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.spinner.js')
-rw-r--r-- | ui/jquery.ui.spinner.js | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 31de2c9da..b78b4dbea 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -49,6 +49,15 @@ $.widget( "ui.spinner", { this._draw(); this._bind( this._events ); this._refresh(); + + // turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._bind( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + }); }, _getCreateOptions: function() { @@ -93,7 +102,7 @@ $.widget( "ui.spinner", { this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); clearTimeout( this.mousewheelTimer ); - this.mousewheelTimer = setTimeout(function() { + this.mousewheelTimer = this._delay(function() { if ( this.spinning ) { this._stop( event ); } @@ -103,7 +112,7 @@ $.widget( "ui.spinner", { "mousedown .ui-spinner-button": function( event ) { // ensure focus is on (or stays on) the text field event.preventDefault(); - if ( document.activeElement !== this.element[ 0 ] ) { + if ( this.document[0].activeElement !== this.element[ 0 ] ) { this.element.focus(); } @@ -151,7 +160,8 @@ $.widget( "ui.spinner", { // IE 6 doesn't understand height: 50% for the buttons // unless the wrapper has an explicit height - if ( this.buttons.height() === uiSpinner.height() && uiSpinner.height() > 0 ) { + if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && + uiSpinner.height() > 0 ) { uiSpinner.height( uiSpinner.height() ); } @@ -301,7 +311,14 @@ $.widget( "ui.spinner", { }, _setOption: function( key, value ) { - this._super( "_setOption", key, value ); + if ( key === "culture" || key === "numberFormat" ) { + var prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + this._super( key, value ); if ( key === "disabled" ) { if ( value ) { @@ -315,7 +332,7 @@ $.widget( "ui.spinner", { }, _setOptions: modifier(function( options ) { - this._super( "_setOptions", options ); + this._super( options ); this._value( this.element.val() ); }), @@ -370,7 +387,7 @@ $.widget( "ui.spinner", { .removeAttr( "aria-valuemin" ) .removeAttr( "aria-valuemax" ) .removeAttr( "aria-valuenow" ); - this._super( "destroy" ); + this._super(); this.uiSpinner.replaceWith( this.element ); }, |