jenkins-bot has submitted this change and it was merged.

Change subject: Update from upstream
......................................................................


Update from upstream

Bug: 43904
Change-Id: I34e8ad3e82ffa23f03b5ddf25e92d850991abb43
---
M lib/jquery.ime/jquery.ime.js
1 file changed, 17 insertions(+), 17 deletions(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js
index dc1d2a4..f93db47 100644
--- a/lib/jquery.ime/jquery.ime.js
+++ b/lib/jquery.ime/jquery.ime.js
@@ -1,4 +1,4 @@
-/*! jquery.ime - v0.1.0 - 2013-05-06
+/*! jquery.ime - v0.1.0 - 2013-05-08
 * https://github.com/wikimedia/jquery.ime
 * Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
 ( function ( $ ) {
@@ -396,8 +396,22 @@
                        newLines,
                        scrollTop;
 
-               if ( document.body.createTextRange ) {
-                       // IE
+               if ( typeof element.selectionStart === 'number' && typeof 
element.selectionEnd === 'number' ) {
+                       // IE9+ and all other browsers
+                       scrollTop = element.scrollTop;
+
+                       // This could be made better if range selection worked 
on browsers.
+                       // But for complex scripts, browsers place cursor in 
unexpected places
+                       // and it's not possible to fix cursor programmatically.
+                       // Ref Bug https://bugs.webkit.org/show_bug.cgi?id=66630
+                       element.value = element.value.substring( 0, start ) + 
replacement
+                                       + element.value.substring( end, 
element.value.length );
+                       // restore scroll
+                       element.scrollTop = scrollTop;
+                       // set selection
+                       element.selectionStart = element.selectionEnd = start + 
replacement.length;
+               } else {
+                       // IE8 and lower
                        selection = rangeForElementIE(element);
                        length = element.value.length;
                        // IE doesn't count \n when computing the offset, so we 
won't either
@@ -413,20 +427,6 @@
                        selection.text = replacement;
                        selection.collapse( false );
                        selection.select();
-               } else {
-                       // All other browsers
-                       scrollTop = element.scrollTop;
-
-                       // This could be made better if range selection worked 
on browsers.
-                       // But for complex scripts, browsers place cursor in 
unexpected places
-                       // and it's not possible to fix cursor programmatically.
-                       // Ref Bug https://bugs.webkit.org/show_bug.cgi?id=66630
-                       element.value = element.value.substring( 0, start ) + 
replacement
-                                       + element.value.substring( end, 
element.value.length );
-                       // restore scroll
-                       element.scrollTop = scrollTop;
-                       // set selection
-                       element.selectionStart = element.selectionEnd = start + 
replacement.length;
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I34e8ad3e82ffa23f03b5ddf25e92d850991abb43
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to