Created
August 28, 2018 10:31
-
-
Save dead-claudia/1dfc8b983dd914c36344d078300306d0 to your computer and use it in GitHub Desktop.
Recast Mithril node removal code
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
function removeNodeFromDOM(vnode) { | |
var parent = vnode.dom.parentNode | |
if (parent != null) { | |
var count = vnode.domSize | |
if (count != null && count > 1) { | |
while (--count) parent.removeChild(vnode.dom.nextSibling) | |
} | |
parent.removeChild(vnode.dom) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment