Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLOSED] Replace $.each with Array.prototype.forEach. #1268

Open
core-ai-bot opened this issue Aug 29, 2021 · 8 comments
Open

[CLOSED] Replace $.each with Array.prototype.forEach. #1268

core-ai-bot opened this issue Aug 29, 2021 · 8 comments

Comments

@core-ai-bot
Copy link
Member

Issue by RaymondLim
Friday Jul 20, 2012 at 17:06 GMT
Originally opened as adobe/brackets#1287


This fixes issue #1098


RaymondLim included the following code: https://github.com/adobe/brackets/pull/1287/commits

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Friday Jul 20, 2012 at 19:18 GMT


We seem inconsistent about iterating jQuery objects, which are array-like but not plain vanilla arrays.

  • In CodeHintManager we used to use $.each(), but this patch changes it to .forEach()
  • In InlineTextEditor we still use $.each()
  • In WorkingSetView & ProjectManager we use .each()
    (note the distinction: $.each() takes the jQ object as an argument, while .each() is a method on the jQ object).

@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?

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Friday Jul 20, 2012 at 19:18 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Friday Jul 20, 2012 at 19:21 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by RaymondLim
Friday Jul 20, 2012 at 22:14 GMT


@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.

@core-ai-bot
Copy link
Member Author

Comment by rwaldron
Saturday Jul 21, 2012 at 00:03 GMT


I'm flattered 😊 that you thought of me

@core-ai-bot
Copy link
Member Author

Comment by pthiess
Saturday Jul 21, 2012 at 03:40 GMT


:)@rwldrn Rick, don't miss the opportunity to share your opinion.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Sunday Jul 22, 2012 at 22:07 GMT


@rwldrn, well you did file the original bug in this case... :-)

@core-ai-bot
Copy link
Member Author

Comment by RaymondLim
Monday Aug 27, 2012 at 22:29 GMT


Closing this pull request since we need to do other cleaning that Peter mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant