aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/jquery/jquery.suggestions.js
diff options
context:
space:
mode:
authorFomafix <fomafix@googlemail.com>2019-06-05 22:08:48 +0200
committerFomafix <fomafix@googlemail.com>2019-06-10 16:17:47 +0200
commitd6689fae9527fcad4a7f1db5f976cdd1a01339f5 (patch)
treec816a036588343e75913d30ae3ff3decf5ac3df1 /resources/src/jquery/jquery.suggestions.js
parent82f5752cb0a582a3c79ef373d42706c604a15805 (diff)
downloadmediawikicore-d6689fae9527fcad4a7f1db5f976cdd1a01339f5.tar.gz
mediawikicore-d6689fae9527fcad4a7f1db5f976cdd1a01339f5.zip
jquery.suggestions: Combine two isRTL checks
Also update comment about the direction. Change-Id: Iba9e925eef3148c2964d51cf5e55402dc85d65dc
Diffstat (limited to 'resources/src/jquery/jquery.suggestions.js')
-rw-r--r--resources/src/jquery/jquery.suggestions.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js
index 4a1d637de949..e071bedd579e 100644
--- a/resources/src/jquery/jquery.suggestions.js
+++ b/resources/src/jquery/jquery.suggestions.js
@@ -78,7 +78,7 @@
*
* @param {string} [options.expandFrom=auto] Which direction to offset the suggestion box from.
* Values 'start' and 'end' translate to left and right respectively depending on the directionality
- * of the current document, according to `$( 'html' ).css( 'direction' )`.
+ * of the current document, according to `$( document.documentElement ).css( 'direction' )`.
* Valid values: "left", "right", "start", "end", and "auto".
*
* @param {boolean} [options.positionFromLeft] Sets `expandFrom=left`, for backwards
@@ -357,7 +357,7 @@
// Process expandFrom, after this it is set to left or right.
context.config.expandFrom = ( function ( expandFrom ) {
var regionWidth, docWidth, regionCenter, docCenter,
- docDir = $( document.documentElement ).css( 'direction' ),
+ isRTL = $( document.documentElement ).css( 'direction' ) === 'rtl',
$region = context.config.$region;
// Backwards compatible
@@ -398,10 +398,10 @@
}
if ( expandFrom === 'start' ) {
- expandFrom = docDir === 'rtl' ? 'right' : 'left';
+ expandFrom = isRTL ? 'right' : 'left';
} else if ( expandFrom === 'end' ) {
- expandFrom = docDir === 'rtl' ? 'left' : 'right';
+ expandFrom = isRTL ? 'left' : 'right';
}
return expandFrom;