MCPcopy
hub / github.com/KaTeX/KaTeX / sizeElementFromChildren

Function sizeElementFromChildren

src/buildCommon.ts:322–345  ·  view source on GitHub ↗
(
    elem: DomSpan | Anchor | HtmlDocumentFragment,
)

Source from the content-addressed store, hash-verified

320 * children.
321 */
322const sizeElementFromChildren = function(
323 elem: DomSpan | Anchor | HtmlDocumentFragment,
324) {
325 let height = 0;
326 let depth = 0;
327 let maxFontSize = 0;
328
329 for (let i = 0; i < elem.children.length; i++) {
330 const child = elem.children[i];
331 if (child.height > height) {
332 height = child.height;
333 }
334 if (child.depth > depth) {
335 depth = child.depth;
336 }
337 if (child.maxFontSize > maxFontSize) {
338 maxFontSize = child.maxFontSize;
339 }
340 }
341
342 elem.height = height;
343 elem.depth = depth;
344 elem.maxFontSize = maxFontSize;
345};
346
347/**
348 * Makes a span with the given list of classes, list of children, and options.

Callers 3

makeSpanFunction · 0.85
makeAnchorFunction · 0.85
makeFragmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…