Status: Unconfirmed Owner: ---- Labels: Type-Bug Pri-2 OS-All Area-Misc New issue 8107 by nicolas.martenet: array is not sorted correctly with custom sort function http://code.google.com/p/chromium/issues/detail?id=8107
Chrome Version : 1.0.154.48 URLs (if applicable) : http://www.w3schools.com/jsref/tryit.asp? filename=tryjsref_sort Other browsers tested: Add OK or FAIL after other browsers where you have tested this issue: Safari 3: not tested but Safari 4 beta doesn't work Firefox 3: OK IE 7: OK What steps will reproduce the problem? 1. Go to http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_sort 2. Modify the script with adding 'function sortNames(a,b){return a > b;} 3. Modify arr.sort() by arr.sort(sortNames) 4. Click on 'Edit and Click me' What is the expected result? the list of names ordered in alphabetical order (Borge, Hege, Jani, Kai Jim, Stale, Tove) What happens instead? the names are not ordered correctly (Borge, Kai Jim, Tove, Hege, Stale, Jani) Please provide any additional information below. Attach a screenshot if possible. With the javascript debuger it seems that the tests are not correct. In chrome the tests are: Jani > Hege, Jany > Stale, Stale > Kai Jim, Hege > Kai Jim, Hege > Borge, Kai Jim > Borge and Hege > Tove which is not sufficient and not efficient Firefox do these tests: Jani > Hege, Jany > Stale, Stale > Kai Jim, Jani > Kai Jim, Borge > Tove, Stale > Borge, Hege > Borge, Hege > Tove, Jani > Tove, Kai Jim > Tove, Stale > Tove Attachments: chrome_sort_issue.JPG 73.6 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ Automated mail from issue updates at http://crbug.com/ Subscription options: http://groups.google.com/group/chromium-bugs -~----------~----~----~----~------~----~------~--~---
