NodeList.forEach is missing

Issue #10638731 • Assigned to Travis L.

Details

Author
Grégoire D.
Created
Jan 24, 2017
Privacy
This issue is public.
Reports
Reported by 2 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.”

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

    Sign in