Semi-working IE support for selecting the location of a syntax error.

This commit is contained in:
Andrew Garrett 2009-01-23 23:49:52 +00:00
parent 792c7d0be6
commit ebafabc610

View file

@ -28,10 +28,15 @@ function processSyntaxResult( request ) {
var position = charArray[1];
var textArea = document.getElementById( wgFilterBoxName );
if (textArea.selectionStart && textArea.selectionEnd) {
textArea.focus();
if (document.selection) {
var sel = document.selection.createRange();
sel.moveStart( 'character', -textArea.value.length );
sel.moveStart( 'character', position );
sel.select();
} else if (textArea.selectionStart && textArea.selectionEnd) {
textArea.selectionStart = position;
textArea.selectionEnd = position;
textArea.focus();
}
}
}