Skip to content

[CommonHTML] regression on develop branch: horizontal stretch causes processing error #1541

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

Closed
pkra opened this issue Jul 4, 2016 · 6 comments
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Not Needed v2.7

Comments

@pkra
Copy link
Contributor

pkra commented Jul 4, 2016

I ran into a regression on the develop branch.

Here's a minimal example. It seems to require the mtable and the mover (this came from an AMScd source).

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mtable rowspacing="5pt" columnspacing="5pt" displaystyle="true">
    <mtr>
      <mtd>
        <mi>F</mi>
      </mtd>
      <mtd>
        <mover>
          <mo minsize="2.75em">&#x2192;</mo>
        </mover>
      </mtd>
      <mtd> 
        <mi>F</mi>
      </mtd>
    </mtr>
  </mtable>
</math>

lastError gave me:

TypeError: Cannot read property 'firstChild' of null
    at CHTMLstretchH (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1959:22)
    at CHTMLstretchCoreH (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1472:28)
    at CHTMLstretchH (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1704:14)
    at CHTMLstretchCoreH (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1472:28)
    at CHTMLstretchH (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1468:36)
    at CHTMLstretchCells (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/autoload/mtable.js?rev=2.6.1:422:55)
    at toCommonHTML (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/autoload/mtable.js?rev=2.6.1:71:12)
    at CHTMLaddChild (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1395:25)
    at CHTMLdefaultNode (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1380:42)
    at toCommonHTML (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:2604:21)
    at CHTMLaddChild (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1395:25)
    at CHTMLdefaultNode (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1380:42)
    at toCommonHTML (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:1733:21)
    at Translate (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:507:14)
    at Object.processOutput (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:2306:51)
    at Function.execute (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:236:26)
    at Function.WAITEXECUTE (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:337:31)
    at cb (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:218:59)
    at Function.WAITEXECUTE (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:341:50)
    at cb (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:218:59)
    at Execute (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:419:36)
    at Object.loadComplete (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:951:35)
    at Function.execute (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:236:26)
    at cb (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:218:59)
    at Process (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:488:38)
    at Push (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:478:49)
    at Init (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:463:17)
    at Function.Init (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:88:23)
    at Function.Queue (https://rawgit.com/mathjax/MathJax/develop/unpacked/MathJax.js:66:54)
    at fontLoaded (https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/jax.js?rev=2.6.1:334:24)
    at https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js?rev=2.6.1:287:7
    at https://rawgit.com/mathjax/MathJax/develop/unpacked/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js?rev=2.6.1:289:3
@pkra pkra added the Accepted Issue has been reproduced by MathJax team label Jul 4, 2016
@pkra pkra added this to the MathJax v2.x.x milestone Jul 4, 2016
@dpvc
Copy link
Member

dpvc commented Jul 4, 2016

Of course, the MathML is invalid, because <mover> requires two children, but the issue is still present if you add a second child (as long as the base is stretchy).

It turns out that this is related to the getNode() changes, and the main fix is to handle that better. But there are also some issues with the stretching code not matching the element being stretched to the proper container DOM node (a problem in CHTMLcoreNode(), and an issue with CHTMLaddChild() not adding a box of the proper type when forceChild forces an empty element to be added.

dpvc added a commit to dpvc/MathJax that referenced this issue Jul 4, 2016
…reNode() step through inferred rows (to match what Core() does). Finally, make CHTMLaddChild() add a box of the correct type if forceChild is set. Resolves issue mathjax#1541.
@dpvc
Copy link
Member

dpvc commented Jul 4, 2016

The issue1541 branch of my fork of MathJax includes fixes for all three issues.

@pkra
Copy link
Contributor Author

pkra commented Jul 4, 2016

Of course, the MathML is invalid, because <mover> requires two children

D'Oh! for overly minimizing my example without sanity checking it (though IIRC the HTML-CSS output handled it ok). Thanks for the quick fix!

@dpvc
Copy link
Member

dpvc commented Jul 4, 2016

Yes, both HTML-CSS and SVG handled the missing element OK. With the patch, so does CommonHTML.

dpvc added a commit that referenced this issue Jul 8, 2016
Fix problems with stretching <mover> in <mtd> elements.  #1541
@dpvc
Copy link
Member

dpvc commented Jul 8, 2016

==> Merged

@dpvc dpvc added Merged Merged into develop branch and removed Ready for Review labels Jul 8, 2016
@dpvc dpvc closed this as completed Jul 8, 2016
@dpvc
Copy link
Member

dpvc commented Aug 9, 2016

There are tests already in the testsuite that should catch this, so I'm marking as "Test Not Needed".

@dpvc dpvc added v2.7 Fixed and removed Merged Merged into develop branch labels Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Not Needed v2.7
Projects
None yet
Development

No branches or pull requests

2 participants