Quick intro
I am working on a web project involving some intense math rendering, and I use latest MathJax version to do it. While I was adding content to one of my pages I noticed a really strange bug. It wouldn't be smart to copy-paste my webpage's full source code, so I simplified it down to this.
Source code
<html>
<head>
<style>
h3 { font-size: 1.3em; }
h4 { font-size: 1.2em; }
h5 { font-size: 1.1em; margin: 1em 0 0.5em; }
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_SVG"></script>
</head>
<body>
<h3>H3 Header</h3>
<h4>H4 header</h4>
<h5>H5 header</h5> 0\(0\) 1\(1\) 2\(2\)
<h5>H5 header</h5> 0\(0\) 1\(1\) 2\(2\)
<h5>H5 header</h5> 0\(0\) 1\(1\) 2\(2\)
<h5>H5 header</h5> 0\(0\) 1\(1\) 2\(2\)
</body>
</html>
Here is also jsFiddle playground.
Output
Screenshot of the resulting webpage
Problem
At some point SVG positioning and sizing messes up, then resets back to normal (look closely at the provided image).
Reproducing the bug
Bug is only present when SVG is used as an output mode. Looks and behaves differently in Chrome and Safari, didn't have a chance to check it with other browsers.
Bug changes its 'location' if you
- add, remove or reposition headers
- change
font-size
for any of the headers - change
margin
Question
What is going on?