Issue metadata
Sign in to add a comment
|
Array.sort doesn't honor the 0 value.
Reported by
michael....@gmail.com,
Jan 26 2018
|
||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Steps to reproduce the problem:
1. In console, paste:
var list = [];
var i = 0;
while (i < 90) {
list.push({value: i});
i++;
}
list.sort(function(a,b){return 0;});
What is the expected behavior?
The list order should remain untouched after sorting.
What went wrong?
The 45th and 1st values have swapped.
Did this work before? Yes I'm not sure.
Chrome version: 63.0.3239.132 Channel: n/a
OS Version: OS X 10.12.5
Flash Version:
,
Jan 26 2018
That's a fair assessment based on the ecma standard. I'll advise my clients to use Safari while I update sorting methods based on previous Chrome behavior. I understand your goal is probably to maximize sort speed with the addition of quicksort - but, in my opinion, its not worth it to take away a commonly used behavior that has a poorly worded standard.
,
Jan 26 2018
JavaScript specification never required the sort to be stable so it won't make sense for Chrome to change its correct behavior suddenly after all the years to implement a non-standard quirk provided by other browsers. If you think the ECMA standard is poorly worded, you can open an issue on their bugtracker.
,
Jan 26 2018
|
|||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||
Comment 1 by woxxom@gmail.com
, Jan 26 2018