(tagName)
| 990 | |
| 991 | |
| 992 | const toNode = function toNode(tagName) { |
| 993 | const node = document.createElement(tagName); // Apply the class |
| 994 | |
| 995 | node.className = createClass(this.classes); // Apply inline styles |
| 996 | |
| 997 | for (const style in this.style) { |
| 998 | if (this.style.hasOwnProperty(style)) { |
| 999 | // $FlowFixMe Flow doesn't seem to understand span.style's type. |
| 1000 | node.style[style] = this.style[style]; |
| 1001 | } |
| 1002 | } // Apply attributes |
| 1003 | |
| 1004 | |
| 1005 | for (const attr in this.attributes) { |
| 1006 | if (this.attributes.hasOwnProperty(attr)) { |
| 1007 | node.setAttribute(attr, this.attributes[attr]); |
| 1008 | } |
| 1009 | } // Append the children, also as HTML nodes |
| 1010 | |
| 1011 | |
| 1012 | for (let i = 0; i < this.children.length; i++) { |
| 1013 | node.appendChild(this.children[i].toNode()); |
| 1014 | } |
| 1015 | |
| 1016 | return node; |
| 1017 | }; |
| 1018 | /** |
| 1019 | * Convert into an HTML markup string |
| 1020 | */ |
nothing calls this directly
no test coverage detected