new Span(content: string | Span | Span, classes: string): voidprivate
A span is the most elementary element that can be rendered. It is composed of an optional body of text and an optional list of children (other spans). Each span can be decorated with CSS classes and style attributes.
content: string | Span | Span
the items 'contained' by this node
list of classes attributes associated with this node
A string of space separated CSS classes associated with this element
An array, potentially empty, of spans which this span encloses
Content of this span. Can be empty.
A set of key/value pairs specifying CSS properties associated with this element.
The measurement from baseline to top, in em.
The measurement from baseline to bottom, in em.
setStyle(prop: string, …value: string | number): stringprivate
Set the value of a CSS property associated with this span. For example, setStyle('border-right', 5.6, 'em');
the CSS property to set
value: string | number repeatable
a series of strings and numbers that will be concatenated.
toMarkup(hskip?: number, hscale?: number): stringprivate
Generate the HTML markup to represent this span.
hskip: number = 0
Space (in mu, 1/18em) to leave on the left side of the span. Implemented as a Unicode character if possible, a margin-left otherwise.
hscale: number = 1.0
If a value is provided, the margins are scaled by this factor.
tryCoalesceWith(span: Span): booleanprivate
Can this span be coalesced with 'span'? This is used to 'coalesce' (i.e. group together) a series of spans that are identical except for their value, and to avoid generating redundant spans. That is: '12' -> "12" rather than: "12"
Update the dimensions of this node based on its children:
- height: distance from bottom to top
- depth: distance from bottom to baseline