* Create a Space node with width given in CSS ems.
(width: number)
| 191 | * Create a Space node with width given in CSS ems. |
| 192 | */ |
| 193 | constructor(width: number) { |
| 194 | this.width = width; |
| 195 | // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html |
| 196 | // for a table of space-like characters. We use Unicode |
| 197 | // representations instead of &LongNames; as it's not clear how to |
| 198 | // make the latter via document.createTextNode. |
| 199 | if (width >= 0.05555 && width <= 0.05556) { |
| 200 | this.character = "\u200a"; //   |
| 201 | } else if (width >= 0.1666 && width <= 0.1667) { |
| 202 | this.character = "\u2009"; //   |
| 203 | } else if (width >= 0.2222 && width <= 0.2223) { |
| 204 | this.character = "\u2005"; //   |
| 205 | } else if (width >= 0.2777 && width <= 0.2778) { |
| 206 | this.character = "\u2005\u200a"; //    |
| 207 | } else if (width >= -0.05556 && width <= -0.05555) { |
| 208 | this.character = "\u200a\u2063"; // ​ |
| 209 | } else if (width >= -0.1667 && width <= -0.1666) { |
| 210 | this.character = "\u2009\u2063"; // ​ |
| 211 | } else if (width >= -0.2223 && width <= -0.2222) { |
| 212 | this.character = "\u205f\u2063"; // ​ |
| 213 | } else if (width >= -0.2778 && width <= -0.2777) { |
| 214 | this.character = "\u2005\u2063"; // ​ |
| 215 | } else { |
| 216 | this.character = null; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Converts the math node into a MathML-namespaced DOM element. |
nothing calls this directly
no outgoing calls
no test coverage detected