Skip to content

Commit 9f793a4

Browse files
committed
Simplifies state setting for attachSpeech.
1 parent b4df886 commit 9f793a4

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ts/a11y/semantic-enrich.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,8 @@ export function EnrichedMathItemMixin<N, T, D, B extends Constructor<AbstractMat
244244
*/
245245
public attachSpeech(document: MathDocument<N, T, D>) {
246246
if (this.state() >= STATE.ATTACHSPEECH) return;
247-
if (this.isEscaped || !document.options.enableEnrichment) {
248-
this.state(STATE.ATTACHSPEECH);
249-
return;
250-
}
247+
this.state(STATE.ATTACHSPEECH);
248+
if (this.isEscaped || !document.options.enableEnrichment) return;
251249
let [speech, braille] = this.existingSpeech();
252250
let [newSpeech, newBraille] = ['', ''];
253251
if ((!speech && document.options.enableSpeech) ||
@@ -262,10 +260,7 @@ export function EnrichedMathItemMixin<N, T, D, B extends Constructor<AbstractMat
262260
}
263261
speech = speech || newSpeech;
264262
braille = braille || newBraille;
265-
if (!speech && !braille) {
266-
this.state(STATE.ATTACHSPEECH);
267-
return;
268-
}
263+
if (!speech && !braille) return;
269264
const adaptor = document.adaptor;
270265
const node = this.typesetRoot;
271266
if (speech) {
@@ -279,7 +274,6 @@ export function EnrichedMathItemMixin<N, T, D, B extends Constructor<AbstractMat
279274
}
280275
this.outputData.speech = speech;
281276
this.outputData.braille = braille;
282-
this.state(STATE.ATTACHSPEECH);
283277
}
284278

285279
};

0 commit comments

Comments
 (0)