https://github.com/marijnh/CodeMirror/issues/1155 has been closed, so you should be able to remove this code.