Replace $.each with _.each

In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.

Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.

Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).

One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.

(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
This commit is contained in:
Scott Feeney
2013-07-29 18:35:44 -04:00
parent 5842d5c335
commit 8703134a23
24 changed files with 113 additions and 143 deletions

View File

@@ -28,14 +28,14 @@ function print_elapsed_time(name, fun) {
/* An IterationProfiler is used for profiling parts of looping
* constructs (like a for loop or $.each). You mark sections of the
* constructs (like a for loop or _.each). You mark sections of the
* iteration body and the IterationProfiler will sum the costs of those
* sections over all iterations.
*
* Example:
*
* var ip = new IterationProfiler();
* $.each(myarray, function (idx, elem) {
* _.each(myarray, function (elem) {
* ip.iteration_start();
*
* cheap_op(elem);