overset/javascript-natural-sort — Issue #3: 3 - Problem sorting numbers under Firefox, Opera and Chrome 
Author: overset
Created: 2012-01-26 09:20:28+00:00
State: open

What steps will reproduce the problem?
1. My application displays a table sorted using js-naturalsort. The rows are not properly sorted in neither browser. To check if the problem was in naturalsort, I tried to sort an array with similar data using Firebug's console.

What is the expected output? What do you see instead?
>>> ["-1","-2","4","-3","0","-5"].sort(naturalSort)
["0", "4", "-1", "-2", "-3", "-5"]

In this case it should work as
>>> ["-1","-2","4","-3","0","-5"].sort(function(a,b){ return parseInt(a) > parseInt(b)} )
["-5", "-3", "-2", "-1", "0", "4"]

What version of the product are you using? On what operating system?
r13, Windows 7 x64.

Original link: http://code.google.com/p/js-naturalsort/issues/detail?id=3