Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[main.js] add missing checks for htmlNode #289

Merged
merged 1 commit into from
Feb 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ function StartQueue() {
//
GetState(data.state);

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

//
// Set up a timeout timer to restart MathJax if it runs too long,
Expand Down Expand Up @@ -784,7 +784,7 @@ function SetRenderer(renderer) {
}

function RerenderSVG(result) {
if (data.html && data.svg) {
if ((data.html || data.htmlNode ) && (data.svg || data.svgNode)) {
timer = setTimeout(RestartMathJax,data.timeout);
var queue = MathJax.Callback.Queue(), $$ = window.Array;
return queue.Push(
Expand Down
26 changes: 26 additions & 0 deletions test/issue288.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var tape = require('tape');
var mjAPI = require("../lib/main.js");

tape('HTML output when requesting both SVG and HTML', function(t) {
t.plan(2);
mjAPI.start();
var tex = 'x';

mjAPI.typeset({
math: tex,
format: "TeX",
htmlNode: true,
svgNode: true
}, function(data) {
t.equal(data.htmlNode.className, 'mjx-chtml MJXc-display', 'htmlNode output is correct');
});

mjAPI.typeset({
math: tex,
format: "TeX",
html: true,
svgNode: true
}, function(data) {
t.ok(data.html, 'html output is present')
});
});