Problem: I am using mathjax to format math equations nicely on a visualforce page.

Everything goes great on a naked vf page.

enter image description here

<apex:page >
<!--script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script-->
<apex:includeScript value="{!$resource.mathjax}"/>
        \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]

(both the static resource and html script tags work)


When I add an apex:tabpanel to the page, the formating disapears.

enter image description here

I know that tabpanel has issues playing nice with jquery. So in a rough stab in the dark, I implemented a similar fix that sfdc outlined in the linked post.

<apex:page >
<!--script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script-->
<apex:includeScript id ="mathjax" value="{!$resource.mathjax}"/>
        \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]

This did nothing so I checked out the chrome js console and found this: enter image description here

Uncaught (in promise) TypeError: Cannot set property 'parent' of undefined
at a (mathjax:1)
at u (mathjax:1)
at _ (mathjax:1)
at A (mathjax:1)
at new <anonymous> (3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript:17)
at Object.node.<computed> [as text] (mathjax:1)
at l.c.create (mathjax:1)
at r.I.compileError (mathjax:1)
at Object.compileError (mathjax:1)
at r.I.compileMath (mathjax:1)

Anyone ever seen something like this?/know how to repair it.


Followed the bouncing ball a bit further: In the JS console I found the following when I clicked on the link of mathjax:1 in the error readout. I believe parent is getting unset when I add tabpanel to the page.

Does anyone know how to re-set or maybe prevent it from going to null?

enter image description here

  • 1
    use edit to include the error message so it gets more eyeballs
    – cropredy
    Nov 14 '19 at 22:06
  • @cropredy Morning! I added the picture. Should I add the error to the title? or it in plain text in the body? Nov 15 '19 at 13:48
  • 1
    The first error shows that mathjax is not defined. Can you check the source listed there to see where that is coming from? It mentions apexpa.., so I don't know if that is coming from Salesforce, or mathjax, but it seems like the variable is getting unset or something like that.
    – Roti
    Nov 15 '19 at 16:44
  • 1
    you might also get some help from stackoverflow where there are many more jQuery experts
    – cropredy
    Nov 15 '19 at 16:46
  • I followed Roti's advice, If that scenario means anything Let me know, Im, going to do some research on it before cross-posting. Nov 15 '19 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.