Based on some investigation, I've managed to come up with a somewhat reliable way to reproduce this bug:
Find a MathJax-heavy post and edit it. Here's one of mine for your convenience.
Make sure the the MathJax "Fast Preview" feature is enabled. (Right-click on any MathJax formula, and make sure that Math Settings ▸ Math Renderer ▸ Fast Preview has a check mark next to it in the context menu.)
Open the developer console (F12 in Chrome / Firefox).
Click on the edit box to focus it. Copy the post source with Ctrl+A, Ctrl+C.
Press Ctrl+V to repeatedly paste the post source into the edit box until you see the following error message in the developer console:
Uncaught TypeError: Cannot read property 'insertBefore' of null
The bug seems to be somewhat browser-dependent. I've managed to reliably reproduce it, using the instructions above, on Chrome 48 (on Windows 7 and Ubuntu Linux) and also on IE 11 on Windows 7. It does not seem to occur on Firefox, however.
IIRC, on Chrome / Win7, I also managed to trigger the bug with Fast Preview disabled, but only when using the Common HTML, Preview HTML or Plain Source math renderers. On Chrome / Ubuntu, however, the bug seems to be only reproducible when using Fast Preview. (Of course, this does not necessarily mean that it's the OS that makes the difference; it could just be some other coincidental difference between the two browser installations.) Alas, I did not do much testing on IE 11, and I don't currently have access to the Win7 box I tested it on.
Just to confuse things, there's also another, fairly benign and presumably unrelated bug that occasionally causes MathJax not to be rendered in the edit preview until the preview is refreshed. This one seems to be a simple race between MathJax processing and Markdown editor initialization. Simply typing anything into the edit box should be enough to trigger a new math rendering pass.
Also, it seems that the error message logged to the dev console is actually a secondary error, triggered while MathJax is trying to emit an earlier error message. However, both the primary and the secondary errors seem to have the same underlying cause: MathJax is trying to insert something before a
script element that has been removed from the DOM, and therefore has no parent node.
Alas, I haven't really been able to diagnose this much further. I can pinpoint the locations where the errors occur: the secondary one happens in here in
MathJax.Hub.formatError(), while the primary error seem to occur here in
MathJax.Extension["fast-preview"].Preview(). In both cases, the statement that throws the error looks something like:
script.parentNode is null, presumably because the
script element has been removed from the DOM. What I haven't managed to figure out, however, is why MathJax is trying to insert something before a removed DOM element.
My guess is that, somehow, repeatedly updating the edit preview with a lot of complex MathJax formulas in it causes a new math processing pass to start before the previous one has properly finished. AFAIK, MathJax should be preventing this from happening, as long as the
Typeset calls are properly queued, but for some reason this mechanism doesn't seem to be working. :(