-
-
Save benjamingwynn/d73277e7db6fb7e0afa5d219a13982c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy current children except a certain child while keeping all refs - a pain in the ass. | |
let i = oldParent.childNodes.length - 1 | |
for (; i >= 0; i -= 1) { | |
const c = oldParent.childNodes[i] | |
// whatever, your condition here | |
if (c.nodeName.toLowerCase() !== "slot") { | |
newParent.appendChild(c) | |
} | |
} | |
// use var instead of let and const for <ES6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment