r3188 committed - spinner: fixed bug with minus values without whole numbers.
Revision: 3188
Author: pazu2k@gmail.com
Date: Thu Sep 3 10:01:12 2009
Log: spinner: fixed bug with minus values without whole numbers.
http://code.google.com/p/jquery-ui/source/detail?r=3188
Modified:
/branches/dev/spinner/ui/ui.spinner.js
=======================================
--- /branches/dev/spinner/ui/ui.spinner.js Thu Aug 27 23:08:31 2009
+++ /branches/dev/spinner/ui/ui.spinner.js Thu Sep 3 10:01:12 2009
@@ -377,11 +377,12 @@
val = val.replace(new
RegExp('\\'+this.options.groupSeparator,'g'), '');
}
val = val.replace(new RegExp('[^' + this._validChars()
+ ']', 'gi'), '').split(this.options.radixPoint);
- result = parseInt(val[0] || 0, this.options.radix);
+ console.log(val);
+ result = parseInt(val[0] == '-' ? 0 : val[0] || 0, this.options.radix);
if (val.length > 1) {
result += parseInt(val[1], this.options.radix) /
Math.pow(this.options.radix, val[1].length) *
// must test first character of val[0] for minus sign because -0 is
parsed as 0 in result
- (val[0][0] == '-' ? -1 : 1);
+ (val[0].substr(0,1) == '-' ? -1 : 1);
}
val = result;
}