| 149 | * This node represents a piece of text. |
| 150 | */ |
| 151 | export class TextNode implements MathDomNode { |
| 152 | text: string; |
| 153 | |
| 154 | constructor(text: string) { |
| 155 | this.text = text; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Converts the text node into a DOM text node. |
| 160 | */ |
| 161 | toNode(): Node { |
| 162 | return document.createTextNode(this.text); |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Converts the text node into escaped HTML markup |
| 167 | * (representing the text itself). |
| 168 | */ |
| 169 | toMarkup(): string { |
| 170 | return escape(this.toText()); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Converts the text node into a string |
| 175 | * (representing the text itself). |
| 176 | */ |
| 177 | toText(): string { |
| 178 | return this.text; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * This node represents a space, but may render as <mspace.../> or as text, |
nothing calls this directly
no outgoing calls
no test coverage detected