Skip to content

Commit b35db44

Browse files
committed
Properly handle additional attributes during inheritance (make copy of attributes so they don't get changed permanently).
1 parent 93a3e28 commit b35db44

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

mathjax3-ts/core/MmlTree/MmlNodes/mtable.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ export class MmlMtable extends AbstractMmlNode {
8484
}
8585
}
8686
display = !!(this.attributes.getExplicit('displaystyle') || this.attributes.getDefault('displaystyle'));
87-
attributes.columnalign = [this.kind, this.attributes.get('columnalign')];
88-
attributes.rowalign = [this.kind, 'center'];
87+
attributes = this.addInheritedAttributes(attributes, {
88+
columnalign: this.attributes.get('columnalign'),
89+
rowalign: 'center'
90+
});
8991
const ralign = (this.attributes.get('rowalign') as string)
9092
.replace(/^\s+/, '').replace(/\s+$/, '').split(/ +/);
9193
for (const child of this.childNodes) {

mathjax3-ts/core/MmlTree/MmlNodes/mtr.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,15 @@ export class MmlMtr extends AbstractMmlNode {
6464
.appendChild(child);
6565
}
6666
}
67-
attributes.rowalign = [this.kind, this.attributes.get('rowalign')];
68-
attributes.columnalign = [this.kind, 'center'];
6967
const calign = (this.attributes.get('columnalign') as string)
7068
.replace(/^\s+/, '').replace(/\s+$/, '').split(/ +/);
69+
if (this.arity === 1) {
70+
calign.unshift(this.parent.attributes.get('side') as string);
71+
}
72+
attributes = this.addInheritedAttributes(attributes, {
73+
rowalign: this.attributes.get('rowalign'),
74+
columnalign: 'center'
75+
});
7176
for (const child of this.childNodes) {
7277
attributes.columnalign[1] = calign.shift() || attributes.columnalign[1];
7378
child.setInheritedAttributes(attributes, display, level, prime);

0 commit comments

Comments
 (0)