(type, attrs, childrenArrayOrVarArgs)
| 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" |
no test coverage detected