MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / createDom

Function createDom

ui/plugins/ui/jasmine/jasmine-html.js:653–688  ·  view source on GitHub ↗
(type, attrs, childrenArrayOrVarArgs)

Source from the content-addressed store, hash-verified

651 }
652
653 function createDom(type, attrs, childrenArrayOrVarArgs) {
654 const el = createElement(type)
655 let children
656
657 if (j$.isArray_(childrenArrayOrVarArgs)) {
658 children = childrenArrayOrVarArgs
659 } else {
660 children = []
661
662 for (let i = 2; i < arguments.length; i++) {
663 children.push(arguments[i])
664 }
665 }
666
667 for (let i = 0; i < children.length; i++) {
668 const child = children[i]
669
670 if (typeof child === "string") {
671 el.appendChild(createTextNode(child))
672 } else {
673 if (child) {
674 el.appendChild(child)
675 }
676 }
677 }
678
679 for (const attr in attrs) {
680 if (attr == "className") {
681 el[attr] = attrs[attr]
682 } else {
683 el.setAttribute(attr, attrs[attr])
684 }
685 }
686
687 return el
688 }
689
690 function pluralize(singular, count) {
691 const word = count == 1 ? singular : singular + "s"

Callers 7

HtmlReporterFunction · 0.85
failureDomFunction · 0.85
debugLogTableFunction · 0.85
summaryListFunction · 0.85
optionsMenuFunction · 0.85
failureDescriptionFunction · 0.85
createExpanderFunction · 0.85

Calls 3

createElementFunction · 0.85
pushMethod · 0.80
appendChildMethod · 0.45

Tested by

no test coverage detected