Skip to content

Commit cf60513

Browse files
committed
Don't produce mml when mmlNode is requested if mml wasn't requested. Resolves #277
1 parent 1ff9d60 commit cf60513

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,13 @@ function GetMML(result) {
537537
}
538538
}
539539
try {
540-
result.mml = jax.root.toMathML('',jax);
541-
if (data.mmlNode) result.mmlNode = jsdom(result.mml).body.firstChild;
540+
var mml = jax.root.toMathML('',jax);
542541
} catch(err) {
543542
if (!err.restart) {throw err;} // an actual error
544543
return MathJax.Callback.After(window.Array(GetMML,result),err.restart);
545544
}
545+
if (data.mml) result.mml = mml;
546+
if (data.mmlNode) result.mmlNode = jsdom(mml).body.firstChild;
546547
}
547548

548549
//

test/issue277.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var tape = require('tape');
22
var mjAPI = require("../lib/main.js");
33

4-
tape('mmlNode should enable mml', function(t) {
4+
tape('mmlNode should not produce mml', function(t) {
55
t.plan(1);
66
mjAPI.start();
77
var tex = 'x';
@@ -11,6 +11,6 @@ tape('mmlNode should enable mml', function(t) {
1111
format: "TeX",
1212
mmlNode: true
1313
}, function(data) {
14-
t.ok(data.mml, 'MathML generated');
14+
t.ok(data.mml === undefined, 'mml not generated');
1515
});
1616
});

0 commit comments

Comments
 (0)