MCPcopy
hub / github.com/MithrilJS/mithril.js / updateComponent

Function updateComponent

render/render.js:503–523  ·  view source on GitHub ↗
(parent, old, vnode, hooks, nextSibling, ns)

Source from the content-addressed store, hash-verified

501 }
502 }
503 function updateComponent(parent, old, vnode, hooks, nextSibling, ns) {
504 vnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))
505 if (vnode.instance === vnode) throw Error("A view cannot return the vnode it received as argument")
506 if (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)
507 updateLifecycle(vnode.state, vnode, hooks)
508 if (vnode.instance != null) {
509 if (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)
510 else updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, ns)
511 vnode.dom = vnode.instance.dom
512 vnode.domSize = vnode.instance.domSize
513 }
514 else if (old.instance != null) {
515 removeNode(old.instance)
516 vnode.dom = undefined
517 vnode.domSize = 0
518 }
519 else {
520 vnode.dom = old.dom
521 vnode.domSize = old.domSize
522 }
523 }
524 function getKeyMap(vnodes, start, end) {
525 var map = {}
526 for (; start < end; start++) {

Callers 1

updateNodeFunction · 0.70

Calls 4

updateLifecycleFunction · 0.70
createNodeFunction · 0.70
updateNodeFunction · 0.70
removeNodeFunction · 0.70

Tested by

no test coverage detected