Edit approval dialog - MathJax not rendered

When reviewing an edit on Physics SE I noticed that an edit made to replace an image of mathematics with MathJax (the preferred choice on Physics SE) was not shown properly when the rendered output was previewed.

Here's an image:

Note on the right the new edit version (awaiting approval or rejection) is shown in green, but instead of the rendered output being shown we get the "raw" MathJax code. It's extremely difficult in many cases to tell if the code is an accurate representation of the image it is replacing and we really need to see properly rendered MathJax in these approval dialogs.

Note we already get to see the "raw" MathJax when we select the "Markdown" option.

As MathJax is such a significant element of Physics SE (and other sites) it's important we get to see the rendered output, not just the code.

For completeness this was on Firefox 78.0.1 64-bit under Linux Mint 18. MathJax correctly renders on the main Physics SE site.

Note also that the issue does not affect the edit history which uses a different layout. That can view rendered and raw MathJax correctly. This issue only affects the review queue AFAIK.

Thanks to member Luuklag for showing me it is possible to add a link to items in the review queue, which I had mistakenly assumed was not possible.

• Including a link to this review item is helpful. You can find it from either the post timelone or your review history. – Luuklag Jul 13 '20 at 4:59
• @Luuklag The problem does not show in the edit revision history. That appears to be a different system as it has three buttons "Inline", "Side by side" and "Side by side Markdown". The review queue dialog has only two buttons "Rendered output" and "Markdown" and only entries on the review queue will show the problem, and they vanish after they leave the queue so I cannot link to one. – StephenG Jul 13 '20 at 11:53
• @Stepen yes you can. physics.stackexchange.com/review/suggested-edits/307186 – Luuklag Jul 13 '20 at 11:56
• @Luuklag Wow. Thanks for that - did not think it was even possible. And well done finding the question, BTW. – StephenG Jul 13 '20 at 12:35
• What do you mean by "That can view rendered"? Do you mean "That can be viewed rendered"? Or something else? – P.Mort. - forgot Clay Shirky_q Jul 14 '20 at 13:34
• It seems that there are a few older related posts here, such as: MathJax rendering for suggested edit queue or MathJax half-broken in suggested edit diffs (and other posts linked there). – Martin Jul 14 '20 at 13:38
• Well that definitely shouldn't happen. This has been added to our list to address, and we'll update here with more when we get to it. – Jon Chan Aug 5 '20 at 20:40
• @JonChan Thanks for the update. Appreciated. – StephenG Aug 7 '20 at 18:42

1. When switching tabs, we failed to call styleCode(), so and code that hadn't been styled wouldn't be.
2. When switching tabs, we set the inline style to display: block via \$(...).show() but we didn't remove the server rendered dno class from the element. MathJax is set up not to run on elements within dno elements because they're assumed to be hidden.
I did, however, find a separate issue on the revisions page that I fixed as well. Now that that post has been alive for a while, the revision that added MathJax (3) is collapsed. If you visited https://physics.stackexchange.com/posts/565310/revisions and your default diff view is "Inline" or "Side-by-Side", expanding 3 would show you the raw MathJax instead of rendering it. Switching to another diff style and back would trigger the rendering. It's a similar deal to before, it just needed a call to styleCode() after the revision was inserted into the page.