Skip to content

Commit

Permalink
Merge pull request #1143 from mathjax/issue3301
Browse files Browse the repository at this point in the history
Improve merging of math lists (mathjax/MathJax#3301).
  • Loading branch information
dpvc authored Nov 12, 2024
2 parents 85673d2 + 3365a1b commit d765f3f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ts/handlers/html/HTMLDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ export class HTMLDocument<N, T, D> extends AbstractMathDocument<N, T, D> {
nodes: HTMLNodeArray<N, T>
): Location<N, T> {
const adaptor = this.adaptor;
for (const list of nodes[N]) {
const [node, n] = list;
const inc = 1 / (nodes[N].length || 1);
let i = N;
for (const [node, n] of nodes[N]) {
if (index <= n && adaptor.kind(node) === '#text') {
return { node: node, n: Math.max(index, 0), delim: delim };
return { i, node, n: Math.max(index, 0), delim };
}
index -= n;
i += inc;
}
return { node: null, n: 0, delim: delim };
return { node: null, n: 0, delim };
}

/**
Expand Down

0 comments on commit d765f3f

Please sign in to comment.