-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Replace $.each with Array.prototype.forEach. #1287
Conversation
@@ -156,7 +156,7 @@ define(function (require, exports, module) { | |||
this.clearList(); | |||
var self = this; | |||
var count = 0; | |||
$.each(this.displayList, function (index, item) { | |||
this.displayList.froEach(function (item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: froEach -> forEach
We seem inconsistent about iterating jQuery objects, which are array-like but not plain vanilla arrays.
@rwldrn, what's the best convention here in your opinion? My assumption would be: .forEach() for "true" arrays, .each() for jQuery objects, and $.each() only for objects/maps. Does that sound right? |
One other note: we also have a few places where $.each() is used to iterate objects/maps, but the inner function misleadingly names its first argument "index," which suggests it's iterating an array when it's not. SpecRunnerUtils and BootstrapReporter both have this problem. |
p.s. if these are too many changes to sneak in on the last day of the sprint, I think it's fine to push this out to sprint 12. Better to wait a couple more days and get everything fully cleaned up IMHO. |
@peterflynn, I'll push this out to sprint 12 so that we can wait for @rwldrn opinion and do extra cleanup that you pointed out. |
I'm flattered 😊 that you thought of me |
:) @rwldrn Rick, don't miss the opportunity to share your opinion. |
@rwldrn, well you did file the original bug in this case... :-) |
Closing this pull request since we need to do other cleaning that Peter mentioned. |
This fixes issue #1098