MCPcopy Index your code
hub / github.com/MithrilJS/mithril.js / createElement

Function createElement

mithril.js:498–525  ·  view source on GitHub ↗
(parent, vnode, hooks, ns, nextSibling)

Source from the content-addressed store, hash-verified

496 insertNode(parent, fragment, nextSibling)
497 }
498 function createElement(parent, vnode, hooks, ns, nextSibling) {
499 var tag = vnode.tag
500 var attrs2 = vnode.attrs
501 var is = attrs2 && attrs2.is
502 ns = getNameSpace(vnode) || ns
503 var element = ns ?
504 is ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :
505 is ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)
506 vnode.dom = element
507 if (attrs2 != null) {
508 setAttrs(vnode, attrs2, ns)
509 }
510 insertNode(parent, element, nextSibling)
511 if (attrs2 != null && attrs2.contenteditable != null) {
512 setContentEditable(vnode)
513 }
514 else {
515 if (vnode.text != null) {
516 if (vnode.text !== "") element.textContent = vnode.text
517 else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
518 }
519 if (vnode.children != null) {
520 var children1 = vnode.children
521 createNodes(element, children1, 0, children1.length, hooks, null, ns)
522 if (vnode.tag === "select" && attrs2 != null) setLateSelectAttrs(vnode, attrs2)
523 }
524 }
525 }
526 function initComponent(vnode, hooks) {
527 var sentinel
528 if (typeof vnode.tag.view === "function") {

Callers 1

createNodeFunction · 0.70

Calls 7

getNameSpaceFunction · 0.70
setAttrsFunction · 0.70
insertNodeFunction · 0.70
setContentEditableFunction · 0.70
VnodeFunction · 0.70
createNodesFunction · 0.70
setLateSelectAttrsFunction · 0.70

Tested by

no test coverage detected