Bug #645
Do not use "for..in" to iterate over js Arrays in Sunstone
Status: | Closed | Start date: | 05/16/2011 | |
---|---|---|---|---|
Priority: | High | Due date: | ||
Assignee: | Hector Sanjuan | % Done: | 100% | |
Category: | Sunstone | |||
Target version: | Release 3.0 | |||
Resolution: | fixed | Pull request: | ||
Affected Versions: |
Description
for...in sentence is meant to list the properties of an object, not to iterate over array elements. If functions are added to the Array prototype, then they are treated as elements of the array, which is a wrong behaviour. Instead, classical for (var x; x < y; x++) loops should be used.
Associated revisions
Bug #645: Iterate on arrays with vanilla loops.
For...in loops on Arrays were changed in to for(i = 0, i<length, ++i) style loops. There where the former form caused problems or problems had been workaround-ed small improvements have been made.
Bug #645: Small fixes in new loops.
History
#1 Updated by Hector Sanjuan about 10 years ago
- % Done changed from 0 to 100
- Resolution set to fixed
#2 Updated by Hector Sanjuan about 10 years ago
- Status changed from New to Closed