see https://github.com/danyaPostfactum/ace/commit/c93d1e209abdde0d97bb6d7fcf5567c5f4bcdd65#lib/ace/lib/dom.js