[Webkit-unassigned] [Bug 47825] New: Different behaviour with the .sort(callback) method (unlike Firefox & Chrome)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 18 08:55:57 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=47825

           Summary: Different behaviour with the .sort(callback) method
                    (unlike Firefox & Chrome)
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Minor
          Priority: P2
         Component: WebCore JavaScript
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: webkit at fgribreau.com


Overview: 
Webkit doesn't seem to correctly handle sort's callback that return a boolean. 

Test case:
[{e:1}, {e:0}, {e:1}].sort(function(a,b){return a.e < b.e});

Actual Results: (it does "nothing")
[{e:1}, {e:0}, {e:1}]

Expected Results (tested with Chromium 6 & Firefox 3.6):
[{e:1}, {e:1}, {e:0}]

Additional Information:
Opera does nothing too.

Hum, after reading ECMA-262 "15.4.4.11 Array.prototype.sort (comparefn)"

"If comparefn is not undefined and is not a consistent comparison function for the elements of this array (see
below), the behaviour of sort is implementation-defined."
I don't know what "implementation-defined" mean in this case but if chromium & firefox do sort this way, maybe it would be a good idea to do the same ?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list