Strange Behavior with Google Chrome

I was testing out Google’s new browser today to see how ReadPath was working, since it makes very heavy use of JavaScript. Overall I’m pretty impressed. Chrome seems to be really fast and pretty much everything worked great. Also, the YUI library seems to be working perfectly.

There was one major bug though. On the news page, there is a folder list on the left hand side. This is populated from data in JavaScript and then written onto the page. The data starts off as an array of the form:

var folders = [{"id":128,"name":"Auto"}

The folder objects from this array were then put into a sparse array of the form:

var folderHash = {};
for(var i = 0; i < foldersSize; i++){
var folder = folders[i];
folderHash[] = folder;

This code was then used to output the folders onto the page:

$H(folderHash).values().each(function(folder) {
...output code...

The anonymous function in every browser other than Chrome lists the folders in the order “Auto”, “Business”, “VMware” (the order from the original folder array). Chrome however outputs them in the order “Business”, “VMware”, “Auto” (id sorted order).

While this is probably a bug in my code since I’m relying on default behaviour instead of explicitly sorting the items the way that I want them, it just shows that there are going to be some differences with the way that Chrome is executing javascript.

One comment on “Strange Behavior with Google Chrome

Comments are closed.