NodeList.forEach is missing

Fixed Issue #10638731

Details

Author
Grégoire D.
Created
Jan 24, 2017
Privacy
This issue is public.
Reports
Reported by 8 people

Sign in to watch or report this issue.

Steps to reproduce

NodeList should implement the iterable interface and provide forEach function.

https://dom.spec.whatwg.org/#interface-nodelist

Attachments

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 https://jsfiddle.net/v6oqkgtt/

      var node = document.createElement("div");
      var kid1 = document.createElement("p");
      var kid2 = document.createTextNode("hey");
      var kid3 = document.createElement("span");
      
      node.appendChild(kid1);
      node.appendChild(kid2);
      node.appendChild(kid3);
      
      var list = node.childNodes;
      
      list.forEach( 
        function(value, key, listObj, argument) { 
          console.log(value + ' ' + key + "/" + this); 
        },
        "arg"
      );
      
    • 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:

      Array.prototype.forEach.call(yourNodeListHere, 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 need to sign in to your Microsoft account to add a comment.

    Sign in