* Create a Space node with width given in CSS ems.
(width)
| 6729 | * Create a Space node with width given in CSS ems. |
| 6730 | */ |
| 6731 | constructor(width) { |
| 6732 | this.width = void 0; |
| 6733 | this.character = void 0; |
| 6734 | this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html |
| 6735 | // for a table of space-like characters. We use Unicode |
| 6736 | // representations instead of &LongNames; as it's not clear how to |
| 6737 | // make the latter via document.createTextNode. |
| 6738 | |
| 6739 | if (width >= 0.05555 && width <= 0.05556) { |
| 6740 | this.character = "\u200a"; //   |
| 6741 | } else if (width >= 0.1666 && width <= 0.1667) { |
| 6742 | this.character = "\u2009"; //   |
| 6743 | } else if (width >= 0.2222 && width <= 0.2223) { |
| 6744 | this.character = "\u2005"; //   |
| 6745 | } else if (width >= 0.2777 && width <= 0.2778) { |
| 6746 | this.character = "\u2005\u200a"; //    |
| 6747 | } else if (width >= -0.05556 && width <= -0.05555) { |
| 6748 | this.character = "\u200a\u2063"; // ​ |
| 6749 | } else if (width >= -0.1667 && width <= -0.1666) { |
| 6750 | this.character = "\u2009\u2063"; // ​ |
| 6751 | } else if (width >= -0.2223 && width <= -0.2222) { |
| 6752 | this.character = "\u205f\u2063"; // ​ |
| 6753 | } else if (width >= -0.2778 && width <= -0.2777) { |
| 6754 | this.character = "\u2005\u2063"; // ​ |
| 6755 | } else { |
| 6756 | this.character = null; |
| 6757 | } |
| 6758 | } |
| 6759 | /** |
| 6760 | * Converts the math node into a MathML-namespaced DOM element. |
| 6761 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected