Page MenuHomePhabricator

Use ES5 methods instead of jQuery iterator methods
Closed, ResolvedPublic


Use .forEach or better yet, inspect the usage of $.each and change it to .map if it is producing a new array, or .reduce if it is collecting a new result based on the array.

We shouldn't use $.each given we can use now the ES5 methods.

Popups => ag --js -Q '$.each'
132:    $.each( errorCases, function ( _, data ) {
138:    $.each( successCases, function ( _, data ) {

688:    $.each( rects, function ( i, rect ) {

61:     $.each( extract, function ( index, part ) {

Acceptance criteria

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 20 2018, 12:56 PM

Change 420793 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/Popups@master] Restrict use of $.each

Jdlrobson triaged this task as Normal priority.Mar 20 2018, 6:03 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Needs Prioritization to Upcoming on the Readers-Web-Backlog board.

Change 420793 merged by jenkins-bot:
[mediawiki/extensions/Popups@master] Hygiene: restrict use of $.each and fix offenders

Joaquin can you sign off this technical task?

Jhernandez closed this task as Resolved.Mar 22 2018, 6:41 PM

Seems ok for now. We can do better at using .map or .reduce but I guess we can address those separately.