MCPcopy Create free account
hub / github.com/TruthHun/BookStack / toNode

Function toNode

static/katex/katex.mjs:992–1017  ·  view source on GitHub ↗
(tagName)

Source from the content-addressed store, hash-verified

990
991
992const 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 */

Callers

nothing calls this directly

Calls 3

createClassFunction · 0.70
setAttributeMethod · 0.45
toNodeMethod · 0.45

Tested by

no test coverage detected