[Webkit-unassigned] [Bug 37123] Sorting array of objects fails.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Apr 5 16:25:19 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=37123
--- Comment #1 from Oliver Hunt <oliver at apple.com> 2010-04-05 16:25:19 PST ---
Created an attachment (id=52586)
--> (https://bugs.webkit.org/attachment.cgi?id=52586)
Test case as an html file
The problem with your test case is that your code is wrong.
the comparator function you provide returns inconsistent values which per spec
results in undefined sorting.
Your comparator function is returning either true or false when it should be
returning -1, 0, or 1, this means your comparator is inconsistent as if i pass
the strings "a" and "b" in one order your comparison function returns true (eg.
1) -- meaning "greater" -- or the other order it returns false (eg. 0) --
meaning "same".
You can read the documentation at
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/sort
--
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