#3868: [chrome] SCAYT toolbar options are in reversed order ----------------------------------+----------------------------------------- Reporter: tobiasz.cudnik | Owner: tobiasz.cudnik Type: Bug | Status: assigned Priority: Normal | Milestone: CKEditor 3.0 Component: General | Version: Keywords: Confirmed V8 Review? | ----------------------------------+-----------------------------------------
Comment(by alfonsoml): The reason of this problem is that for Chrome the sort function is not stable. That means that when two elements compare as equal in a custom sort, as it does happen in this situation, the behavior is undefined. It doesn't have to keep the original order. They explain it briefly in http://code.google.com/p/v8/issues/detail?id=90 which points to https://bugzilla.mozilla.org/show_bug.cgi?id=224128 that was checked for Firefox 3, so that explains also the difference with Firefox 2. So that means that it's not a browser bug, just a difference of opinions; it can't be detected, as the behavior is undefined, the test might say that it has been sorted correctly, but it was just a lucky situation; and the solutions are to add a third key to provide the default sort or use a custom function like patch 2. A simple script to test it: {{{ function dump(data) { document.write("<p>Contents of the array: ") for(var i=0; i<data.length; i++) { document.write(data[i].name); if (i<(data.length-1)) document.write(", "); } document.write("</p>"); } var simpleArray = [ {name:'enable (1)'}, {name:'options (2)'}, {name:'languages (3)'}, {name:'about (4)'}] dump(simpleArray); simpleArray.sort( function( itemA, itemB ) { return 0; // No sort }); dump(simpleArray); }}} -- Ticket URL: <http://dev.fckeditor.net/ticket/3868#comment:6> FCKeditor <http://www.fckeditor.net/> The text editor for Internet ------------------------------------------------------------------------------ _______________________________________________ FCKeditor-Trac mailing list FCKeditor-Trac@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fckeditor-trac