* Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`) * into an unbreakable HTML node of class .base, with proper struts to * guarantee correct vertical extent. `buildHTML` calls this repeatedly to * make up the entire expression as a sequence of unbreakable units.
(children: HtmlDomNode[], options: Options)
| 297 | * make up the entire expression as a sequence of unbreakable units. |
| 298 | */ |
| 299 | function buildHTMLUnbreakable(children: HtmlDomNode[], options: Options) { |
| 300 | // Compute height and depth of this chunk. |
| 301 | const body = makeSpan(["base"], children, options); |
| 302 | |
| 303 | // Add strut, which ensures that the top of the HTML element falls at |
| 304 | // the height of the expression, and the bottom of the HTML element |
| 305 | // falls at the depth of the expression. |
| 306 | const strut = makeSpan(["strut"]); |
| 307 | strut.style.height = makeEm(body.height + body.depth); |
| 308 | if (body.depth) { |
| 309 | strut.style.verticalAlign = makeEm(-body.depth); |
| 310 | } |
| 311 | body.children.unshift(strut); |
| 312 | |
| 313 | return body; |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Take an entire parse tree, and build it into an appropriate set of HTML |