marijnh/CodeMirror2 — pull request #721 by bfrohs (2012-08-13 14:26:49+00:00)
Title: Fix issues introduced in 76dd7c6475e71fce142ce75c6acce61ce2ad1ea0 and update `autofocus` documentation.

Your patch (76dd7c6475e71fce142ce75c6acce61ce2ad1ea0) to close #714 introduced a few issues:

* `autofocus` attribute no longer works for IE in the situations where it chokes on `document.activeElement`
* In some cases, `autofocus` attribute support is broken in *every* browser, as the editor loads before *any* element is actually focused
* Outdates the documentation

To fix the IE issue, I've fallen back to always applying focus to the editor, as that's typically better than no focus at all.

To fix the loading issues, the `autofocus` option is set to `true` whenever the `autofocus` attribute is found. Then, if a *different* element has already been focused, the `autofocus` option is set to `false`. Per [your request](https://github.com/marijnh/CodeMirror2/pull/714#issuecomment-7691630), if the `autofocus` option set manually, the editor will *always* receive focus.