Closed
Description
Issue Summary
A newline at the end of some MathML in a call to mathml2chtml causes an error (actually, the call never returns)
This works
MathJax.mathml2chtml("<math><mi>XXX</mi></math>");
This fails:
MathJax.mathml2chtml("<math><mi>XXX</mi></math>\n");
Steps to Reproduce:
I tried to get a codepen example to run, and codepen complained about "MathJax" not being defined. Here's some HTML that shows the problem (the "AFTER..." is never shown):
<!DOCTYPE html>
<html>
<head>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js"></script>
<script>
function ConvertMathML() {
MathJax.startup.defaultReady();
document.getElementById("before").innerHTML = "BEFORE conversion";
let foo = MathJax.mathml2chtml("<math><mi>XXX</mi></math>\n");
document.getElementById("after").innerHTML = "AFTER conversion";
}
</script>
</head>
<body>
<button onclick="ConvertMathML()"> Click me to see bug </button>
<p id="before"></p>
<p id="after"></p>
</body>
</html>