Skip to content

Commit ec084b0

Browse files
authored
Merge pull request #1379 from mathjax/update/keep-attrs
Make the keep-attrs attribute into a property, since it is removed after use
2 parents 96e9192 + f5429ea commit ec084b0

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

ts/input/tex/FilterUtil.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,11 @@ const FilterUtil = {
179179
*/
180180
cleanAttributes(arg: { data: ParseOptions }) {
181181
const node = arg.data.root;
182-
node.walkTree((mml: MmlNode, _d: any) => {
183-
const attribs = mml.attributes;
184-
if (!attribs) return;
182+
node.walkTree((mml: MmlNode) => {
185183
const keep = new Set(
186-
((attribs.get('mjx-keep-attrs') as string) || '').split(/ /)
184+
((mml.getProperty('keep-attrs') as string) || '').split(/ /)
187185
);
188-
attribs.unset('mjx-keep-attrs');
186+
const attribs = mml.attributes;
189187
for (const key of attribs.getExplicitNames()) {
190188
if (
191189
!keep.has(key) &&
@@ -194,7 +192,7 @@ const FilterUtil = {
194192
attribs.unset(key);
195193
}
196194
}
197-
}, {});
195+
});
198196
},
199197

200198
/**

ts/input/tex/base/BaseMethods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ const BaseMethods: { [key: string]: ParseMethod } = {
11251125
attr = attr.substring(match[0].length);
11261126
}
11271127
if (keep.length) {
1128-
def['mjx-keep-attrs'] = keep.join(' ');
1128+
node.setProperty('keep-attrs', keep.join(' '));
11291129
}
11301130
const textNode = parser.create('text', replaceUnicode(text));
11311131
node.appendChild(textNode);

0 commit comments

Comments
 (0)