* (bug 31847) Fix positioning of WikiEditor 'header' insertions when selection is...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 21 Oct 2011 00:15:45 +0000 (00:15 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 21 Oct 2011 00:15:45 +0000 (00:15 +0000)
commitd73613dbdb581fe307bbbce408fb2592ee6abb57
tree4859600129d806230043726e3e534dc6ddb4bf1e
parenta34075b2171966024e742fa01ffb64e7cbd7459d
* (bug 31847) Fix positioning of WikiEditor 'header' insertions when selection is empty in IE 7/8

Follows up to the test cases added in r100391. jquery.textSelection's getCaretPosition() for IE needs to focus the textarea first in order to get consistent results when there's an empty selection -- getSelection() which returns the text already does this.

Because focus had previously been stolen by the drop-down menus in WikiEditor's toolbar, the saveCursorAndScrollTop() was getting a bogus result from getCaretPosition, saving that, then restoring the bad selection (wiping out the original caret position) right before going ahead with the encapsulateText call.

Now seems to get the correct caret position, and also doesn't appear to interfere with selections.
resources/jquery/jquery.textSelection.js