Skip to content

Commit 60951e0

Browse files
committed
condense if block
1 parent 243e89d commit 60951e0

File tree

2 files changed

+4282
-7
lines changed

2 files changed

+4282
-7
lines changed

Diff for: src/node.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,13 @@ export class MathJaxNode_ extends React.Component<Props & MathJaxContextValue> {
115115
setScriptText(text: string) {
116116
const inline = this.props.inline;
117117
const type = types[this.props.input];
118-
if (!this.script) {
119-
if (this.nodeRef.current) {
120-
this.script = document.createElement("script");
121-
this.script.type = `math/${type}; ${inline ? "" : "mode=display"}`;
122-
this.nodeRef.current.appendChild(this.script);
123-
}
118+
119+
if (!this.script && this.nodeRef.current) {
120+
this.script = document.createElement("script");
121+
this.script.type = `math/${type}; ${inline ? "" : "mode=display"}`;
122+
this.nodeRef.current.appendChild(this.script);
124123
}
125124

126-
// It _should_ be defined at this point, we'll just return at this point now
127125
if (!this.script) {
128126
return;
129127
}

0 commit comments

Comments
 (0)