Skip to content

Commit

Permalink
Update native wrap function
Browse files Browse the repository at this point in the history
From [the docs](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild):

_The Node.appendChild() method adds a node to the end of the list of children of a specified parent node. If the given child is a reference to an existing node in the document, appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node)._

So, no need to remove it first since it will be moved anyway.
  • Loading branch information
GrayedFox committed Sep 5, 2019
1 parent 04aae44 commit ed840ad
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ function exampleFilter(elem) {
const wrapper = document.createElement('div');
wrapper.className = 'wrapper';
el.parentNode.insertBefore(wrapper, el);
el.parentNode.removeChild(el);
wrapper.appendChild(el);
});
```
Expand Down

0 comments on commit ed840ad

Please sign in to comment.