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

Function createElement

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

Source from the content-addressed store, hash-verified

98 insertNode(parent, fragment, nextSibling)
99 }
100 function createElement(parent, vnode, hooks, ns, nextSibling) {
101 var tag = vnode.tag
102 var attrs = vnode.attrs
103 var is = attrs && attrs.is
104
105 ns = getNameSpace(vnode) || ns
106
107 var element = ns ?
108 is ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :
109 is ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)
110 vnode.dom = element
111
112 if (attrs != null) {
113 setAttrs(vnode, attrs, ns)
114 }
115
116 insertNode(parent, element, nextSibling)
117
118 if (attrs != null && attrs.contenteditable != null) {
119 setContentEditable(vnode)
120 }
121 else {
122 if (vnode.text != null) {
123 if (vnode.text !== "") element.textContent = vnode.text
124 else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
125 }
126 if (vnode.children != null) {
127 var children = vnode.children
128 createNodes(element, children, 0, children.length, hooks, null, ns)
129 if (vnode.tag === "select" && attrs != null) setLateSelectAttrs(vnode, attrs)
130 }
131 }
132 }
133 function initComponent(vnode, hooks) {
134 var sentinel
135 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