return function() {
var previous = this.options.value;
fn.apply( this, arguments );
- this._format();
- this._aria();
+ this._refresh();
if ( previous !== this.options.value ) {
this._trigger( "change" );
}
this._value( this.options.value );
this._draw();
this._mousewheel();
- this._aria();
+ this._refresh();
},
_getCreateOptions: function() {
this._value( this._trimValue( this.options.value ) );
}),
- _aria: function() {
- this.element.attr({
- "aria-valuemin": this.options.min,
- "aria-valuemax": this.options.max,
- "aria-valuenow": this.options.value
- });
- },
-
_parse: function( val ) {
if ( typeof val === "string" ) {
val = $.global && this.options.numberFormat ? $.global.parseFloat( val ) : +val;
_format: function() {
var num = this.options.value;
- this.element.val( $.global && this.options.numberFormat ? $.global.format( num, this.options.numberFormat ) : num );
+ return $.global && this.options.numberFormat ? $.global.format( num, this.options.numberFormat ) : num;
+ },
+
+ _refresh: function() {
+ this.element
+ .val( this._format() )
+ .attr({
+ "aria-valuemin": this.options.min,
+ "aria-valuemax": this.options.max,
+ "aria-valuenow": this.options.value
+ });
},
// update the value without triggering change
_value: function( value ) {
this.options.value = this._trimValue( this._parse(value) );
- this._format();
- this._aria();
+ this._refresh();
},
destroy: function() {
value: function( newVal ) {
if ( !arguments.length ) {
- return this._parse( this.element.val() );
+ return this._format();
}
this.option( "value", newVal );
},