MCPcopy
hub / github.com/KaTeX/KaTeX / Span

Class Span

src/domTree.ts:212–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 * children.
211 */
212export class Span<ChildType extends VirtualNode> implements HtmlDomNode {
213 children: ChildType[];
214 attributes!: Record<string, string>;
215 classes!: string[];
216 height!: number;
217 depth!: number;
218 width: number | null | undefined;
219 maxFontSize!: number;
220 style!: CssStyle;
221 /**
222 * Italic correction carried over from a SymbolNode when the symbol is
223 * wrapped in a vlist (e.g. \oiint / \oiiint). Read by supsub to adjust
224 * subscript positioning. Only set when nonzero; use `?? 0` at read sites.
225 */
226 italic?: number;
227
228 constructor(
229 classes?: string[],
230 children?: ChildType[],
231 options?: Options,
232 style?: CssStyle,
233 ) {
234 initNode.call(this, classes, options, style);
235 this.children = children || [];
236 }
237
238 /**
239 * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
240 * all browsers support attributes the same, and having too many custom
241 * attributes is probably bad.
242 */
243 setAttribute(attribute: string, value: string) {
244 this.attributes[attribute] = value;
245 }
246
247 hasClass(className: string): boolean {
248 return this.classes.includes(className);
249 }
250
251 toNode(): HTMLElement {
252 return toNode.call(this, "span");
253 }
254
255 toMarkup(): string {
256 return toMarkup.call(this, "span");
257 }
258}
259
260/**
261 * This node represents an anchor (<a>) element with a hyperlink. See `span`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…