Comment #12 on issue 164 by erik.corry: Wrong order in Object properties
interation
http://code.google.com/p/v8/issues/detail?id=164
In fact Safari and FF do not agree. Consider:
<script>
var a = new Array();
a["x"] = 2;
a[3] = 2;
a[0] = 2;
var s = "";
for (x in a) { s += x; }
alert(s);
</script>
FF x30
Safari 03x
Chrome 03x
Opera x30
If you use Object() instead of Array() you get
FF x30
Safari x30
Chrome 03x
Opera x30
Or try the following:
<script>
var a = new Array();
a[6] = 2;
a[3] = 2;
a[80239402] = 2;
a[239402] = 2;
var s = "-";
for (x in a) { s += x + "-"; }
alert(s);
</script>
You will get:
FF -3-6-80239402-239402-
Safari -3-6-80239402-239402-
Chrome -3-6-239402-80239402-
Opera -6-3-80239402-239402-
Or the same with Object:
FF -6-3-80239402-239402-
Safari -6-3-80239402-239402-
Chrome -3-6-239402-80239402-
Opera -6-3-80239402-239402-
In the this case FF and Safari agree, but their order for arrays is not
predictable,
since it is neither sorted in numeric or in insertion order.
I haven't involved properties on the prototype here or deleted properties,
but there
are differences there too. It is best to write your JS programs so they do
not
depend on a certain iteration order.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev