Opened 16 years ago

Closed 16 years ago

#533 closed defect (duplicate)

dojo.collections.DictionaryIterator doesn't support iteration over one item

Reported by: [email protected] Owned by: anonymous
Priority: high Milestone:
Component: General Version: 0.2
Keywords: iterator Cc:
Blocked By: Blocking:


Reproduce the bug with the following code snippet:

//Create a dictionary with one item
var aDictionary = new dojo.collections.Dictionary();

//Iterate it with a "atEnd" while loop
var iterator = aDictionary.getIterator();
while (!iterator.atEnd ) {

The alert statement will not be executed because atEnd is incorrectly initialized in DictionaryIterator?. Line 47 of Collections.js,

   this.atEnd = (position>=arr.length-1);

should be replaced with

   this.atEnd = (position>=arr.length);

in order to support while loops using atEnd

Change History (1)

comment:1 Changed 16 years ago by anonymous

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.