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

toMathML loses element attributes during a restart #971

Closed
dpvc opened this issue Dec 6, 2014 · 3 comments

Comments

Projects
None yet
1 participant
@dpvc
Copy link
Member

commented Dec 6, 2014

If toMathML() needs to perform a restart during a Get() that is testing the value of an attribute, then the value of that attribute is lost. This is because toMathML() removes the attribute temporarily during the test, and if the restart occurs, it never puts it back.

A test case is:

<!DOCTYPE html>
<html>
<head>
<title>Force toMathML() restart</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  TeX: {extensions: ["extpfeil.js","action.js"]}
});

function getMathML(jax,callback) {
  var mml;
  try {
    mml = jax.root.toMathML("",jax);
  } catch(err) {
    console.log("toMathML() restarting");
    if (!err.restart) {throw err} // an actual error
    return MathJax.Callback.After([getMathML,jax,callback],err.restart);
  }
  MathJax.Callback(callback)(mml);
}

MathJax.Hub.Queue(function () {
  var jax = MathJax.Hub.getAllJax()[1];
  getMathML(jax,function (mml) {console.log(mml)});
});
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>

\(\Newextarrow{\xreset}{0,0}{0x21A0}\)
\(\toggle{A}{\xreset{a}}\endtoggle\)

</body>
</html>

where the <mo> for the arrow loses its stretchy attribute.

@dpvc dpvc added the Accepted label Dec 6, 2014

@dpvc dpvc added this to the MathJax 2.5 milestone Dec 6, 2014

dpvc pushed a commit to dpvc/MathJax that referenced this issue Dec 6, 2014

Davide P. Cervone
Add a flag to Get() to look up only the inherited value, not the one …
…from the element itself, so that toMathML() doesn't have to delete and replace the attibutes. Resolves issue mathjax#971.
@dpvc

This comment has been minimized.

Copy link
Member Author

commented Dec 6, 2014

This is resolved in the issue971 branch of my fork of MathJax

@dpvc

This comment has been minimized.

Copy link
Member Author

commented Dec 7, 2014

=> Merged.

@dpvc dpvc added Merged and removed Ready for Review labels Dec 7, 2014

@dpvc dpvc closed this Dec 7, 2014

@dpvc dpvc added Test Available and removed Test Needed labels Jan 13, 2015

@dpvc

This comment has been minimized.

Copy link
Member Author

commented Jan 13, 2015

=> In Testsuite

Parsing/issue971.html

(I had to change the character used to one that is not stretchy by default since toMathML() now trims default attributes properly.)

@dpvc dpvc added Fixed v2.5 and removed Merged labels Jan 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.