r103138 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103137‎ | r103138 | r103139 >
Date:09:59, 15 November 2011
Author:catrope
Status:ok
Tags:
Comment:
(bug 32241) Fix flickering behavior in IE. Patch by Lupo. See also r102948
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.textSelection.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.textSelection.js
@@ -37,6 +37,19 @@
3838 }
3939 }
4040
 41+/**
 42+ * Helper function for IE for activating the textarea. Called only in the
 43+ * IE-specific code paths below; makes use of IE-specific non-standard
 44+ * function setActive() if possible to avoid screen flicker.
 45+ */
 46+function activateElementOnIE( element ) {
 47+ if ( element.setActive ) {
 48+ element.setActive(); // bug 32241: doesn't scroll
 49+ } else {
 50+ $( element ).focus(); // may scroll (but we patched it above)
 51+ }
 52+}
 53+
4154 var fn = {
4255 /**
4356 * Get the contents of the textarea
@@ -54,7 +67,7 @@
5568 if ( $(e).is( ':hidden' ) ) {
5669 // Do nothing
5770 } else if ( document.selection && document.selection.createRange ) {
58 - $(e).focus();
 71+ activateElementOnIE( e );
5972 var range = document.selection.createRange();
6073 retval = range.text;
6174 } else if ( e.selectionStart || e.selectionStart == '0' ) {
@@ -171,7 +184,7 @@
172185 }
173186 } else if ( document.selection && document.selection.createRange ) {
174187 // IE
175 - $(this).focus();
 188+ activateElementOnIE( this );
176189 if ( context ) {
177190 context.fn.restoreCursorAndScrollTop();
178191 }
@@ -240,7 +253,7 @@
241254 // the selection ranges when textarea isn't focused. This can
242255 // lead to saving a bogus empty selection, which then screws up
243256 // whatever we do later (bug 31847).
244 - $(e).focus();
 257+ activateElementOnIE( e );
245258
246259 // IE Support
247260 var preFinished = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r103160REL1_18 MFT r102948, r103074, r103138reedy12:55, 15 November 2011
r1031921.18wmf1 MFT r102948, r103138reedy16:45, 15 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102948(bug 32241) WikiEditor scrolls the browser and does not insert in IE7, IE8, I...catrope08:37, 14 November 2011

Status & tagging log