Calling adoptNode purges Symbol.iterator from children

Not reproducible Issue #21865421

Details

Author
Maciej C.
Created
May 30, 2019
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
42.17134
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

Description

The adoptNode method should leave the parameter node intact and only change its ownerDocument, yet after calling the method, children of the node looses Symbol.iterator property.

One of the consequences is losing the ability to easily cast HtmlCollection to array with [...htmlCollection] syntax.

Minimal reproduction:

clone = document.documentElement.cloneNode();

iframe = document.createElement('iframe');
document.body.appendChild(iframe);

console.info(Symbol.iterator in clone.children); // true
iframe.contentWindow.document.adoptNode(clone);
console.info(Symbol.iterator in clone.children); // false

Observations

I found out that after calling adoptNode on the node, __proto__ of its children changes from HTMLCollection to HTMLCollectionPrototype.

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Zachariah L.”

    • Hi Maciej!

      Thank you for contacting us about this issue! I tested your reproduction on
      Microsoft Edge 44.18362.1.0 Microsoft EdgeHTML 18.18362 and I received identical functionality to both Chrome and Firefox. What version of Microsoft Edge are you running? 

      How to find your version of Microsoft Edge: https://support.microsoft.com/en-us/help/4027011/microsoft-edge-find-out-which-version-you-have

      Thanks,
      Zach

    • Hi Maciej!

      For now, I will resolve this issue as "Not Reproducible". If you are still experiencing this problem then please feel free to reopen this issue with the information requested and I will resume my investigation.

      Thanks,
      Zach

    • Microsoft Edge Team

      Changed Status to “Not reproducible”

    • Changed Status from “Not reproducible”

    • Hi Zachariah,

      I assumed that my problem was with the adoptNode function, because on my website i had Symbol.iterator in node’s children before calling it (maybe it was the outcome of using js bundler and polyfills in my project).

      When I looked into the Edge behaviour on other websites now, I see that the problem is even worse. Children of the node doesn’t have the Symbol.iterator property at all. My minimal reproduction can be shorten to:

      Symbol.iterator in document.documentElement.children; // false
      

      In both Chrome and Firefox the property is available, and casting to an array with:

      [...htmlCollection]
      

      syntax is possible.

      I’m running Microsoft Edge 42.17134.1.0 Microsoft EdgeHTML 17.17134.

      Best regards,
      Maciej Ciesinski

    • Microsoft Edge Team

      Changed Assigned To to “Zachariah L.”

    • Hi Maciej!

      Thanks for getting back to me! I tested your new reproduction on Microsoft Edge 44.18362.1.0 Microsoft EdgeHTML 18.18362 and I received identical functionality to both Chrome and Firefox. Symbol.iterator in document.documentElement.children; resolves as true in all three browsers. What version of Microsoft Edge are you running? 

      Thanks,
      Zach

    • Hi Maciej!

      Seeing as this isn’t reproducible in the newer build, I will resolve this as "Not Reproducible". If you are still experiencing this problem after upgrading your browser, then please feel free to reopen this issue.

      Thanks,
      Zach

    • Microsoft Edge Team

      Changed Status to “Not reproducible”

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

    Sign in