MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / elt

Function elt

src/client/ejs.mjs:69–87  ·  view source on GitHub ↗
(type, attrs)

Source from the content-addressed store, hash-verified

67 })
68
69 function elt(type, attrs) {
70 let firstChild = 1
71 let node = document.createElement(type)
72 if (attrs && typeof attrs == "object" && attrs.nodeType == null) {
73 for (let attr in attrs) if (attrs.hasOwnProperty(attr)) {
74 let value = attrs[attr]
75 if (attr == "css") node.style.cssText = value
76 else if (typeof value !== "string") node[attr] = value
77 else node.setAttribute(attr, value)
78 }
79 firstChild = 2
80 }
81 for (let i = firstChild; i < arguments.length; ++i) {
82 let child = arguments[i]
83 if (typeof child == "string") child = document.createTextNode(child)
84 node.appendChild(child)
85 }
86 return node
87 }
88
89 const contextFacet = Facet.define({
90 combine(vs) { return vs[0] }

Callers 5

activateCodeFunction · 0.85
openMenuFunction · 0.85
showEditorControlsFunction · 0.85
constructorMethod · 0.85
constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected