Bug Tracker

Changes between Initial Version and Version 1 of Ticket #7260, comment 1


Ignore:
Timestamp:
Oct 20, 2010, 5:25:30 PM (5 years ago)
Author:
jitter
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7260, comment 1

    initial v1  
    1 I think you misread the documentation. `$.each` behaves exactly as expected and as documented.
     1This exact behavior is well documented thus `$.each` behaves exactly as expected.
    22
    33From http://api.jquery.com/jQuery.each/
    44>Arrays and **array-like objects with a length property** (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
    55
    6 This sentence covers your case, stating that objects with a length property (as in your example) are iterated by numeric index.
    7 
    8 So if you remove/name the length property in your sample object `$.each` while behave as expected.
    9 
    106Here a [http://www.jsfiddle.net/jitter/qvWAQ/ live test case] to show what is happening.