webcomponents / polyfills

Web Components Polyfills
BSD 3-Clause "New" or "Revised" License
1.15k stars 165 forks source link

[ShadyDOM] Polyfill affecting NodeList liveness in Edge #80

Open TimvdLippe opened 6 years ago

TimvdLippe commented 6 years ago

From @peterjosling on October 3, 2016 13:6

I've got some code using an IE-specific hack to set innerHTML on an SVG element. The hack works fine in Chrome (always), but breaks in Edge when the full webcomponents.js is included. (Code words fine with -lite). JSbin here. In Chrome/Safari, the loop body executes once. In Edge, it loops infinitely.

As far as I'm aware, the children NodeList should be live, as it's active in the DOM - and that's how it behaves in all browsers including Edge when webcomponents.js is not included.

Copied from original issue: webcomponents/webcomponentsjs#630

TimvdLippe commented 6 years ago

From @CITguy on April 24, 2017 22:45

childNodes is a read-only property. Its length doesn't change, so you never reach your exit condition for your while loop.

Try iterating over div.children instead.

var children = div.children;
for (var i = 0; i < children.length; i++) {
    svg.appendChild(children[i]);
}
TimvdLippe commented 6 years ago

From @peterjosling on April 24, 2017 22:57

The code works fine in all of Chrome, Safari and Edge without webcomponents.js installed — is it not specified behaviour?

The actual code in question isn't owned by my team so we weren't able to modify it. We instead decided to remove webcomponents.js entirely as we didn't need it any longer.

TimvdLippe commented 6 years ago

From @e111077 on April 24, 2017 23:52

@notwaldorf (I'm not a part of the org so I can't tag) this is a source:hooli bug.

TimvdLippe commented 6 years ago

This is an issue in ShadyDOM still: http://jsbin.com/muyivurufe/1/edit?html,js,console

morewry commented 6 years ago

Is https://github.com/webcomponents/shadydom/pull/226 related? What about https://github.com/webcomponents/shadydom/pull/286?

dfreedm commented 5 years ago

This may be fixed in ShadyDOM after the refactoring.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.