mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 06:28:23 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user