r103160 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103159‎ | r103160 | r103161 >
Date:12:55, 15 November 2011
Author:reedy
Status:ok
Tags:
Comment:
REL1_18 MFT r102948, r103074, r103138
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/CREDITS (modified) (history)
  • /branches/REL1_18/phase3/resources/jquery/jquery.textSelection.js (modified) (history)
  • /branches/REL1_18/phase3/resources/mediawiki.action/mediawiki.action.edit.js (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/CREDITS
@@ -114,6 +114,7 @@
115115 * Louperivois
116116 * Lucas Garczewski
117117 * Luigi Corsaro
 118+* Lupo
118119 * Manuel Menal
119120 * Marcin Cieślak
120121 * Marcus Buck
Index: branches/REL1_18/phase3/resources/jquery/jquery.textSelection.js
@@ -2,6 +2,26 @@
33 * These plugins provide extra functionality for interaction with textareas.
44 */
55 ( function( $ ) {
 6+
 7+if (document.selection && document.selection.createRange) {
 8+ // On IE, patch the focus() method to restore the windows' scroll position
 9+ // (bug 32241)
 10+ $.fn.extend({
 11+ focus : (function ( _focus ) {
 12+ return function () {
 13+ if ( arguments.length == 0 ) {
 14+ var $w = $( window );
 15+ var state = {top: $w.scrollTop(), left: $w.scrollLeft()};
 16+ var result = _focus.apply( this, arguments );
 17+ window.scrollTo( state.top, state.left );
 18+ return result;
 19+ }
 20+ return _focus.apply( this, arguments );
 21+ };
 22+ })( $.fn.focus )
 23+ });
 24+}
 25+
626 $.fn.textSelection = function( command, options ) {
727
828 /**
@@ -17,6 +37,19 @@
1838 }
1939 }
2040
 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+
2154 var fn = {
2255 /**
2356 * Get the contents of the textarea
@@ -34,7 +67,7 @@
3568 if ( $(e).is( ':hidden' ) ) {
3669 // Do nothing
3770 } else if ( document.selection && document.selection.createRange ) {
38 - e.focus();
 71+ activateElementOnIE( e );
3972 var range = document.selection.createRange();
4073 retval = range.text;
4174 } else if ( e.selectionStart || e.selectionStart == '0' ) {
@@ -150,7 +183,7 @@
151184 }
152185 } else if ( document.selection && document.selection.createRange ) {
153186 // IE
154 - $(this).focus();
 187+ activateElementOnIE( this );
155188 if ( context ) {
156189 context.fn.restoreCursorAndScrollTop();
157190 }
@@ -212,12 +245,12 @@
213246 getCaretPosition: function( options ) {
214247 function getCaret( e ) {
215248 var caretPos = 0, endPos = 0;
216 - if ( $.browser.msie ) {
 249+ if ( document.selection && document.selection.createRange ) {
217250 // IE doesn't properly report non-selected caret position through
218251 // the selection ranges when textarea isn't focused. This can
219252 // lead to saving a bogus empty selection, which then screws up
220253 // whatever we do later (bug 31847).
221 - e.focus();
 254+ activateElementOnIE( e );
222255
223256 // IE Support
224257 var preFinished = false;
Index: branches/REL1_18/phase3/resources/mediawiki.action/mediawiki.action.edit.js
@@ -85,7 +85,7 @@
8686 // Create button bar
8787 mw.toolbar.init();
8888
89 - $( '#wpSummary, #wpTextbox1' ).focus( function() {
 89+ $( 'textarea, input:text' ).focus( function() {
9090 currentFocused = $(this);
9191 });
9292
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
9393 Merged /trunk/phase3:r102948,103074,103138

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
r103074Make sure that the old insertTags of mediawiki.action.edit.js works with each...hartman23:28, 14 November 2011
r103138(bug 32241) Fix flickering behavior in IE. Patch by Lupo. See also r102948catrope09:59, 15 November 2011

Status & tagging log