File tree 2 files changed +8
-28
lines changed
2 files changed +8
-28
lines changed Original file line number Diff line number Diff line change @@ -143,42 +143,22 @@ function reject(message, log) {
143
143
}
144
144
145
145
/**
146
- * Apply MathJax rendering to an element, and optionally set its text
146
+ * Apply MathJax rendering to an element, and optionally set its text.
147
147
*
148
148
* If MathJax is not available, make no changes.
149
149
*
150
- * Returns the output any number of typeset elements as an array or undefined if
151
- * MathJax was not available.
152
- *
153
150
* Parameters
154
151
* ----------
155
- * element: Node, NodeList, or jQuery selection
156
- * text: option string
152
+ * element: Node
153
+ * text: optional string
157
154
*/
158
155
function typeset ( element , text ) {
159
- if ( arguments . length > 1 ) {
160
- if ( element . length ) {
161
- for ( var i = 0 ; i < element . length ; ++ i ) {
162
- var el = element [ i ] ;
163
- el . textContent = text ;
164
- }
165
- } else {
166
- element . textContent = text ;
167
- }
156
+ if ( text !== void 0 ) {
157
+ element . textContent = text ;
168
158
}
169
- if ( ! window . MathJax ) {
170
- return ;
171
- }
172
- var output = [ ] ;
173
- if ( element . length ) {
174
- for ( var i = 0 ; i < element . length ; ++ i ) {
175
- var el = element [ i ] ;
176
- output . push ( MathJax . Hub . Queue ( [ 'Typeset' , MathJax . Hub , el ] ) ) ;
177
- }
178
- } else {
179
- output . push ( MathJax . Hub . Queue ( [ 'Typeset' , MathJax . Hub , element ] ) ) ;
159
+ if ( window . MathJax ) {
160
+ MathJax . Hub . Queue ( [ 'Typeset' , MathJax . Hub , element ] ) ;
180
161
}
181
- return output ;
182
162
}
183
163
184
164
/**
Original file line number Diff line number Diff line change @@ -759,7 +759,7 @@ var DOMWidgetViewMixin = {
759
759
} ,
760
760
761
761
typeset : function ( element , text ) {
762
- utils . typeset . apply ( null , arguments ) ;
762
+ utils . typeset ( element , text ) ;
763
763
}
764
764
} ;
765
765
You can’t perform that action at this time.
0 commit comments