MCPcopy Create free account
hub / github.com/KaTeX/KaTeX / toNode

Method toNode

src/mathMLTree.ts:223–232  ·  view source on GitHub ↗

* Converts the math node into a MathML-namespaced DOM element.

()

Source from the content-addressed store, hash-verified

221 * Converts the math node into a MathML-namespaced DOM element.
222 */
223 toNode(): Node {
224 if (this.character) {
225 return document.createTextNode(this.character);
226 } else {
227 const node = document.createElementNS(
228 "http://www.w3.org/1998/Math/MathML", "mspace");
229 node.setAttribute("width", makeEm(this.width));
230 return node;
231 }
232 }
233
234 /**
235 * Converts the math node into an HTML markup string.

Callers

nothing calls this directly

Calls 2

makeEmFunction · 0.90
setAttributeMethod · 0.45

Tested by

no test coverage detected