Skip to content

Commit 20acddf

Browse files
authored
Merge pull request #1319 from mathjax/fix/mo-mathml-spacing
Handle mml spacing for mo with no parent (like surd for root).
2 parents 71fec6e + f887ac6 commit 20acddf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ts/output/common/Wrapper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,8 @@ export class CommonWrapper<
10591059
if (!parent || !parent.isKind('mrow') || parent.childNodes.length === 1) {
10601060
return;
10611061
}
1062+
const n = parent.childIndex(child);
1063+
if (n === null) return;
10621064
//
10631065
// Get the lspace and rspace
10641066
//
@@ -1075,8 +1077,7 @@ export class CommonWrapper<
10751077
// If there are two adjacent <mo>, use enough left space to make it
10761078
// the maximum of the rspace of the first and lspace of the second
10771079
//
1078-
const n = parent.childIndex(child);
1079-
if (n === 0) return;
1080+
if (!n) return;
10801081
const prev = parent.childNodes[n - 1] as AbstractMmlNode;
10811082
if (!prev.isEmbellished) return;
10821083
const bbox = this.jax.nodeMap.get(prev).getBBox();

0 commit comments

Comments
 (0)