Created
October 29, 2017 04:28
-
-
Save anonymous/082caa01aef5b8d2aa0c7f2fa8110efb to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // 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