NodeList.forEach is missing

Fixed Issue #10638731


Grégoire D.
Jan 24, 2017
This issue is public.
Reported by 10 people

Sign in to watch or report this issue.

Steps to reproduce

NodeList should implement the iterable interface and provide forEach function.


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Brad E.”

      Changed Status to “Not reproducible”

    • Hello,

      Thank you for providing this information about the issue. We are unable to reproduce this problem in Edge. Please reopen this case when you can provide us with a sample code or webpage to test.

      Best Wishes,
      The MS Edge Team

    • Changed Status from “Not reproducible”

    • Take MDN snippet for example.
      A fiddle here

      var node = document.createElement("div");
      var kid1 = document.createElement("p");
      var kid2 = document.createTextNode("hey");
      var kid3 = document.createElement("span");
      var list = node.childNodes;
        function(value, key, listObj, argument) { 
          console.log(value + ' ' + key + "/" + this); 
    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

    • This can also be reproduced by attempting to call forEach on a NodeList returned from querySelectorAll:

      document.querySelectorAll("div").forEach(item => console.log(item))

      Works in other browsers, but not Edge. In the meantime, I have worked around this by calling Array.prototype.forEach instead:, yourFunctionHere)
    • Microsoft Edge Team

      Changed Assigned To from “Steven K.” to “James M.”

      Changed Assigned To to “Travis L.”

      Changed Status to “Needs root cause”

      Changed Assigned To from “Travis L.” to “Jeff W.”

      Changed Status from “Needs root cause” to “Confirmed”

      Changed Status from “Confirmed” to “Fixed”

    • Hello,

      Thank you for providing this information about the issue. We have confirmed the problem, and we are working on a solution for a future build of Edge. We are presently tracking this issue as a duplicate of an existing internal bug report. We look forward to additional feedback you may have on how we can improve Microsoft Edge.

      Best Wishes,
      The MS Edge Team

    • Thanks for the response, James. I look forward to trying this when it hits an Insider build.

      Possibly related: #5998615: NodeList should be iterable

    • You can add forEach support for NodeList manually using this simple code. It just references the Array.prototype.forEach if it exists but isn’t available on NodeList type objects.

      if (!NodeList.prototype.forEach && Array.prototype.forEach) {
        NodeList.prototype.forEach = Array.prototype.forEach;

      Make sure to support older browsers by adding forEach polyfill

    You need to sign in to your Microsoft account to add a comment.

    Sign in