Skip to content

Instantly share code, notes, and snippets.

@dead-claudia
Created August 28, 2018 10:31
Show Gist options
  • Save dead-claudia/1dfc8b983dd914c36344d078300306d0 to your computer and use it in GitHub Desktop.
Save dead-claudia/1dfc8b983dd914c36344d078300306d0 to your computer and use it in GitHub Desktop.
Recast Mithril node removal code
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