mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Spinner: Use Globalize 1.x
This commit is contained in:
parent
450d75f912
commit
e1b0a2777a
@ -14,6 +14,7 @@
|
|||||||
// AMD. Register as an anonymous module.
|
// AMD. Register as an anonymous module.
|
||||||
define([
|
define([
|
||||||
"jquery",
|
"jquery",
|
||||||
|
"globalize",
|
||||||
"./core",
|
"./core",
|
||||||
"./widget",
|
"./widget",
|
||||||
"./button"
|
"./button"
|
||||||
@ -23,7 +24,7 @@
|
|||||||
// Browser globals
|
// Browser globals
|
||||||
factory( jQuery );
|
factory( jQuery );
|
||||||
}
|
}
|
||||||
}(function( $ ) {
|
}(function( $, Globalize ) {
|
||||||
|
|
||||||
function spinner_modifier( fn ) {
|
function spinner_modifier( fn ) {
|
||||||
return function() {
|
return function() {
|
||||||
@ -407,9 +408,10 @@ return $.widget( "ui.spinner", {
|
|||||||
|
|
||||||
_parse: function( val ) {
|
_parse: function( val ) {
|
||||||
if ( typeof val === "string" && val !== "" ) {
|
if ( typeof val === "string" && val !== "" ) {
|
||||||
val = window.Globalize && this.options.numberFormat ?
|
// FIXME handle optional different locales
|
||||||
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
|
val = Globalize ? Globalize.parseNumber( val ) : +val;
|
||||||
}
|
}
|
||||||
|
// TODO: Why not to return NaN?
|
||||||
return val === "" || isNaN( val ) ? null : val;
|
return val === "" || isNaN( val ) ? null : val;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -417,9 +419,8 @@ return $.widget( "ui.spinner", {
|
|||||||
if ( value === "" ) {
|
if ( value === "" ) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return window.Globalize && this.options.numberFormat ?
|
// FIXME handle optional different locales
|
||||||
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
|
return Globalize ? Globalize.formatNumber( value, this.options.numberFormat ) : value;
|
||||||
value;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_refresh: function() {
|
_refresh: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user