Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/189162

Change subject: Skip an old IE 8 bug workaround in WikiEditor on IE 11/Spartan
......................................................................

Skip an old IE 8 bug workaround in WikiEditor on IE 11/Spartan

An early version of WikiEditor added a workaround for a reported
bug with IE 8 where textarea scroll and selection state was lost
when the contents were modified.

This doesn't seem to be needed on modern versions of IE such as 11
and above and the newer 'Edge' HTML engine mode in Windows 10.

Actually, I can't reproduce it in Windows 7 with IE 8 either from
the original bugs, but just in case it's needed on some particular
version that we don't know about I've only added a check for modern
IEs, which is already in use on other old-IE workarounds in the
module.

Bug: T88875
Change-Id: I25b667a8d8378c417441adee5d97571c71a1c8c7
---
M modules/jquery.wikiEditor.js
1 file changed, 12 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiEditor 
refs/changes/62/189162/1

diff --git a/modules/jquery.wikiEditor.js b/modules/jquery.wikiEditor.js
index 95f3c69..b2fa68b 100644
--- a/modules/jquery.wikiEditor.js
+++ b/modules/jquery.wikiEditor.js
@@ -427,27 +427,29 @@
                },
 
                /**
-                * Save scrollTop and cursor position for IE
+                * Save scrollTop and cursor position for old IE (<=10)
+                * Related to IE 8 issues reported as T25485 and T25061
                 */
                saveCursorAndScrollTop: function () {
-                       if ( $.client.profile().name === 'msie' ) {
-                               var IHateIE = {
+                       if ( $.client.profile().name === 'msie' && 
document.selection && document.selection.createRange ) {
+                               var IHateIE8 = {
                                        'scrollTop': 
context.$textarea.scrollTop(),
                                        'pos': context.$textarea.textSelection( 
'getCaretPosition', { startAndEnd: true } )
                                };
-                               context.$textarea.data( 'IHateIE', IHateIE );
+                               context.$textarea.data( 'IHateIE', IHateIE8 );
                        }
                },
 
                /**
-                * Restore scrollTo and cursor position for IE
+                * Restore scrollTo and cursor position for IE (<=10)
+                * Related to IE 8 issues reported as T25485 and T25061
                 */
                restoreCursorAndScrollTop: function () {
-                       if ( $.client.profile().name === 'msie' ) {
-                               var IHateIE = context.$textarea.data( 'IHateIE' 
);
-                               if ( IHateIE ) {
-                                       context.$textarea.scrollTop( 
IHateIE.scrollTop );
-                                       context.$textarea.textSelection( 
'setSelection', { start: IHateIE.pos[0], end: IHateIE.pos[1] } );
+                       if ( $.client.profile().name === 'msie' && 
document.selection && document.selection.createRange ) {
+                               var IHateIE8 = context.$textarea.data( 
'IHateIE' );
+                               if ( IHateIE8 ) {
+                                       context.$textarea.scrollTop( 
IHateIE8.scrollTop );
+                                       context.$textarea.textSelection( 
'setSelection', { start: IHateIE8.pos[0], end: IHateIE8.pos[1] } );
                                        context.$textarea.data( 'IHateIE', null 
);
                                }
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/189162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b667a8d8378c417441adee5d97571c71a1c8c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiEditor
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to