Skip to content

Commit

Permalink
Cleanup insertAfterOrAtStart (#16914)
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell authored Jul 19, 2018
1 parent 47a9a6b commit 9470695
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,8 @@ export function copyChildren(from, to) {
* @param {?Node} after
*/
export function insertAfterOrAtStart(root, element, after) {
if (after) {
if (after.nextSibling) {
root.insertBefore(element, after.nextSibling);
} else {
root.appendChild(element);
}
} else {
// Add at the start.
root.insertBefore(element, root.firstChild);
}
const before = after ? after.nextSibling : root.firstChild;
root.insertBefore(element, before);
}

/**
Expand Down

0 comments on commit 9470695

Please sign in to comment.