Skip to content

Commit f1946b2

Browse files
committed
[main.js] add missing checks for htmlNode
Fixes #288
1 parent 5bb9b98 commit f1946b2

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ function StartQueue() {
684684
//
685685
GetState(data.state);
686686

687-
var renderer = (data.html ? "CommonHTML" : "SVG");
687+
var renderer = ( (data.html || data.htmlNode) ? "CommonHTML" : "SVG");
688688

689689
//
690690
// Set up a timeout timer to restart MathJax if it runs too long,
@@ -784,7 +784,7 @@ function SetRenderer(renderer) {
784784
}
785785

786786
function RerenderSVG(result) {
787-
if (data.html && data.svg) {
787+
if ((data.html || data.htmlNode ) && (data.svg || data.svgNode)) {
788788
timer = setTimeout(RestartMathJax,data.timeout);
789789
var queue = MathJax.Callback.Queue(), $$ = window.Array;
790790
return queue.Push(

test/issue288.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var tape = require('tape');
2+
var mjAPI = require("../lib/main.js");
3+
4+
tape('HTML output when requesting both SVG and HTML', function(t) {
5+
t.plan(2);
6+
mjAPI.start();
7+
var tex = 'x';
8+
9+
mjAPI.typeset({
10+
math: tex,
11+
format: "TeX",
12+
htmlNode: true,
13+
svgNode: true
14+
}, function(data) {
15+
t.equal(data.htmlNode.className, 'mjx-chtml MJXc-display', 'htmlNode output is correct');
16+
});
17+
18+
mjAPI.typeset({
19+
math: tex,
20+
format: "TeX",
21+
html: true,
22+
svgNode: true
23+
}, function(data) {
24+
t.ok(data.html, 'html output is present')
25+
});
26+
});

0 commit comments

Comments
 (0)