Array.sort doesn't work with strings as keys

RESOLVED INVALID

Status

()

Core
JavaScript Engine
RESOLVED INVALID
8 years ago
8 years ago

People

(Reporter: Thomas Baquet, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5
Build Identifier: Mozilla Fennec 1.1a2pre

Method Array.sort doesn't work using strings as keys, with and without a function given in parameter for the method sort

Reproducible: Always

Actual Results:  
The Array is not sorted, (function return immediately?)


Used when programming a Fennec extension
> Method Array.sort doesn't work using strings as keys

  javascript:alert(["foo", "bar", "something"].sort())

works fine for me.  Please give actual steps to reproduce this bug.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
(Reporter)

Comment 2

8 years ago
var array = new Array();
array["feel"] = "lles";
array["abim"] = "io";
array["meee"] = "amour";
alert(array.sort());

I use string as key in state of integers. In your test, you didn't.
Resolution: INCOMPLETE → FIXED
In that case, invalid.  The spec clearly defines sort() to work only on the properties of the array whose names are integers.
Resolution: FIXED → INVALID
You need to log in before you can comment on or make changes to this bug.