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

Function SpaceNode

static/katex/katex.js:6793–6820  ·  view source on GitHub ↗

* Create a Space node with width given in CSS ems.

(width)

Source from the content-addressed store, hash-verified

6791 * Create a Space node with width given in CSS ems.
6792 */
6793 function SpaceNode(width) {
6794 this.width = void 0;
6795 this.character = void 0;
6796 this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html
6797 // for a table of space-like characters. We use Unicode
6798 // representations instead of &LongNames; as it's not clear how to
6799 // make the latter via document.createTextNode.
6800
6801 if (width >= 0.05555 && width <= 0.05556) {
6802 this.character = "\u200A"; // &VeryThinSpace;
6803 } else if (width >= 0.1666 && width <= 0.1667) {
6804 this.character = "\u2009"; // &ThinSpace;
6805 } else if (width >= 0.2222 && width <= 0.2223) {
6806 this.character = "\u2005"; // &MediumSpace;
6807 } else if (width >= 0.2777 && width <= 0.2778) {
6808 this.character = "\u2005\u200A"; // &ThickSpace;
6809 } else if (width >= -0.05556 && width <= -0.05555) {
6810 this.character = "\u200A\u2063"; // &NegativeVeryThinSpace;
6811 } else if (width >= -0.1667 && width <= -0.1666) {
6812 this.character = "\u2009\u2063"; // &NegativeThinSpace;
6813 } else if (width >= -0.2223 && width <= -0.2222) {
6814 this.character = "\u205F\u2063"; // &NegativeMediumSpace;
6815 } else if (width >= -0.2778 && width <= -0.2777) {
6816 this.character = "\u2005\u2063"; // &NegativeThickSpace;
6817 } else {
6818 this.character = null;
6819 }
6820 }
6821 /**
6822 * Converts the math node into a MathML-namespaced DOM element.
6823 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected