Skip to content

Commit

Permalink
Merge pull request #346 from mathjax/issue2202
Browse files Browse the repository at this point in the history
Fix problem with math following <br>.  mathjax/MathJax#2202
  • Loading branch information
dpvc committed Sep 27, 2019
2 parents 45c7e61 + 97dcd58 commit ef5c599
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ts/handlers/html/HTMLDocument.ts
Expand Up @@ -94,10 +94,11 @@ export class HTMLDocument<N, T, D> extends AbstractMathDocument<N, T, D> {
* @return {Location} The Location object for the position of the delimiter in the document
*/
protected findPosition(N: number, index: number, delim: string, nodes: HTMLNodeArray<N, T>): Location<N, T> {
const adaptor = this.adaptor;
for (const list of nodes[N]) {
let [node, n] = list;
if (index <= n) {
return {node: node, n: index, delim: delim};
if (index <= n && adaptor.kind(node) === '#text') {
return {node: node, n: Math.max(index, 0), delim: delim};
}
index -= n;
}
Expand Down

0 comments on commit ef5c599

Please sign in to comment.