New issue
Advanced search Search tips

Issue 1882 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 90
Owner: ----
Closed: Dec 2011
HW: ----
NextAction: ----
OS: ----
Priority: ----
Type: ----



Sign in to add a comment

Array sorting doesn't work properly

Reported by paulpmi...@gmail.com, Dec 30 2011

Issue description

I've found very strange bug on V8 3.8.3 / 3.7.x.

Safari: works properly
Firefox: works properly

Code:
['8', 'vendor/1', 'vendor/3', 'vendor/4', '11', 'vendor/2', '7', '9', '10', 'vendor/6', 'vendor/5'].sort(function() {return 0;});

Expected: (unchanged)
['8', 'vendor/1', 'vendor/3', 'vendor/4', '11', 'vendor/2', '7', '9', '10', 'vendor/6', 'vendor/5']

Actual:
['vendor/2', '8', 'vendor/3', 'vendor/4', '11', 'vendor/1', '7', '9', '10', 'vendor/6', 'vendor/5']

Interesting, that the same array without element '11' is sorted properly.
 
Mergedinto: 90
Status: Duplicate
This is working as intended. Per ECMA-262 5th Array.prototype.sort is not guaranteed to be stable. 

Sign in to add a comment