Strange behaviour in the HTML Editor

Previously reported here: Anki 2.1.34/35 Beta

This also started to hit me in 2.1.37. It can be especially annoying when editing hairy mathjax equations as it breaks the rendering and you have to manually remove the spans.