Version: (using KDE KDE 3.1.2) Installed from: Gentoo Packages Compiler: gcc 3.2.3 OS: Linux This gives [Infinity, 0] instead of [0, Infinity]: [0, Infinity].sort( function ( a, b ) { return a - b } ); sort() doesn't seem to handle ±Infinity as return values of the compare function correctly. ECMAScript doesn't exclude ±Infinity as possible return values.
Actually, every return value not fitting into 32 bit fails.
After looking at the code, this seems to fixed with revision 1.48 of kdelibs/kjs/array_object.cpp , but I leave this bug open until I can verify in the next release. http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kjs/array_object.cpp#rev1.48
Your test case (added to khtmltests/js/Array.js) indeed works with current CVS. Closing.