Skip to main content

Bug Tracker

Side navigation

#7686 closed enhancement (invalid)

Opened December 02, 2010 10:09PM UTC

Closed December 03, 2010 01:18AM UTC

For loop should be changed to while loop

Reported by: Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Line 612 of core.js in $.each();

for ( ; i < length; ) { could be better written as

while ( i < length ) {

It is less confusing, and even faster in some browsers according to

I have made the change here:

First bug report, I hope I did this correctly.

Attachments (0)
Change History (2)

Changed December 02, 2010 11:13PM UTC by rwaldron comment:1

owner: →
status: newpending

I'm getting almost identical results in Chrome.

Changed December 03, 2010 01:18AM UTC by snover comment:2

resolution: → invalid
status: pendingclosed

Thanks for the report, but this is not a valid enhancement. That jsperf test is invalid; you are failing to reset the iterator between tests. Properly resetting the iterator value between tests, such as in this test, shows that the two loop structures function identically.