Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
javascript
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
24 Jun 2025 at 08:44 UTC
Updated:
29 Jul 2025 at 12:14 UTC
Jump to comment: Most recent
A querySelectorAll() method returns NodeList value and which has forEach() method. A forEach() method calls each element in NodeList so no need to count NodeList item and iterate in a for loop.
For example, active-link.js.
Use NodeList.forEach() and remove item counting and a for loop.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tom kondaComment #4
tom kondaComment #5
smustgrave commentedWith my javascript eyes on this seems like a good conversion, leaning on tests that active-link.js breakage would show.
Comment #6
oily commentedAre there not other places where this fix can be applied?
Comment #7
oily commentedThere appear to be several instances in those files where the same sub-optimal syntax is used. Should they be included in this issue or in a follow-up?
Comment #10
nod_Let's do follow-ups, I'd rather get that in regularly than wait 6 months for a big MR.
Committed 93279d3 and pushed to 11.x. Thanks!