If you're typing up a post with quite a bit of LaTeX, and you're looking at your post preview to check your formulae as you type them up, then every time you press a key, the site re-renders all of the latex formulae you've already typed, causing your entire post to flicker. This isn't a huge problem, but it is a bit distracting.
Surely MathJax has a feature allowing you to re-render one specific formula rather than re-rendering all formulae on the page, no? Only the formula being edited needs to be re-rendered.
The flowchart seems pretty simple:
If the user inserts a character:
If it's inside a LaTeX formula (it's inserted somewhere between two dollar signs), the re-render that formula.
If it's a closing dollar sign ending an incomplete LaTeX formula, render that formula.
Otherwise, don't re-render anything.
If the user deletes a character:
If it's inside a formula, re-render that formula.
If it's a dollar sign and removing it causes a formula to break, then de-render that formula.
Otherwise, don't re-render or de-render anything.