webcomponents / webcomponents/polyfills

[ShadyDOM] Node.prototype.replaceChild removes node when same ref_node is used

Open
#349 3 comments 0 reactions 1 assignee Claimed by @aomarks View on GitHub
Focus Area: Standards & Polyfills Package: shadydom Type: Bug wontfix
Dominant language
HTML
Stars
1.2k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

### 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

1. Create a `div` and a `span` within
2. Get a reference to both elements.
3. Execute `replaceChild` on `div`, but use `span` for both the node as the ref_node
4. The `span` element is not connected anymore.

#### Expected behavior

The `span` element is untouched. (check other browsers)

#### Actual behavior

The `span` element has been cleaned

### Version

@webcomponents/webcomponentsjs@2.4.3

### Browsers affected

- [ ] Chrome
- [ ] Firefox
- [x] Edge (non Chromium versions)
- [ ] Safari
- [x] IE 11

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.