polyfills
polyfills copied to clipboard
[ShadyDOM] Node.prototype.replaceChild removes node when same ref_node is used
Description
When using Node.prototype.replaceChild with the same node as ref_node, the node gets cleaned. (eg. removed from its parent)
Example
https://jsbin.com/qajapuxupa/1/edit?html,console,output
Steps to reproduce
- Create a
divand aspanwithin - Get a reference to both elements.
- Execute
replaceChildondiv, but usespanfor both the node as the ref_node - The
spanelement is not connected anymore.
Expected behavior
The span element is untouched. (check other browsers)
Actual behavior
The span element has been cleaned
Version
@webcomponents/[email protected]
Browsers affected
- [ ] Chrome
- [ ] Firefox
- [x] Edge (non Chromium versions)
- [ ] Safari
- [x] IE 11
The issue resides here: https://github.com/webcomponents/polyfills/blob/master/packages/shadydom/src/patches/Node.js#L463
The two functions should only be executed if node and ref_node are different.
If you guys like, I can send in a MR? 😃
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.
This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!