Henning Snater has uploaded a new change for review.

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


Change subject: Updated adaptlettercase utility function documentation
......................................................................

Updated adaptlettercase utility function documentation

Change-Id: I09e8a84490380f317af9f80678083b2c739701ac
---
M ValueView/resources/jquery.ui/jquery.ui.suggester.js
M ValueView/resources/jquery.util/jquery.util.adaptlettercase.js
2 files changed, 15 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/90/76890/1

diff --git a/ValueView/resources/jquery.ui/jquery.ui.suggester.js 
b/ValueView/resources/jquery.ui/jquery.ui.suggester.js
index 543a870..30f050d 100644
--- a/ValueView/resources/jquery.ui/jquery.ui.suggester.js
+++ b/ValueView/resources/jquery.ui/jquery.ui.suggester.js
@@ -300,8 +300,8 @@
 
                                        if ( this.options.adaptLetterCase ) {
                                                this.term = incomplete = 
$.util.adaptlettercase(
-                                                       complete,
                                                        incomplete,
+                                                       complete,
                                                        
this.options.adaptLetterCase
                                                );
                                        }
diff --git a/ValueView/resources/jquery.util/jquery.util.adaptlettercase.js 
b/ValueView/resources/jquery.util/jquery.util.adaptlettercase.js
index 0215dee..cb95568 100644
--- a/ValueView/resources/jquery.util/jquery.util.adaptlettercase.js
+++ b/ValueView/resources/jquery.util/jquery.util.adaptlettercase.js
@@ -12,34 +12,34 @@
        'use strict';
 
        /**
-        * Adapts the letter case of a source string to a destination string. 
The destination string is
-        * supposed to consist our of the source string's first letter(s).
+        * Applies the letter case of a source string to a destination string. 
The destination string's
+        * character sequence is supposed to mirror the source string's first 
(or all) characters
+        * (although the characters may differ in their letter-case of course).
         *
-        * @param {string} source
-        * @param {string} destination
+        * @param {string} destination String the source string's letter-case 
shall be applied to.
+        * @param {string} source String whose letter-case shall be applied to 
destination.
         * @param {string|undefined} method "all" will adapt source's letter 
case for all destination
         *        characters, "first" will adapt the first letter only. By 
default, no adaption is
         *        taking place.
         * @return {string}
         *
-        * @throws {Error} if source and/or destination string is not specified.
-        * @throws {Error} if source string does not start with destination 
string.
+        * @throws {Error} if source and/or destination string is/are not 
specified.
         */
-       return function( source, destination, method ) {
-               if( !source || !destination ) {
-                       throw new Error( 'Source and destination need to be 
specified.' );
+       return function( destination, source, method ) {
+               if( !destination || !source ) {
+                       throw new Error( 'Incomplete string and complete string 
need to be specified.' );
                }
 
-               if( source.toLowerCase().indexOf( destination.toLowerCase() ) 
=== -1 ) {
-                       throw new Error( source + ' does not start with ' + 
destination + '.' );
+               if( source.toLowerCase().indexOf( destination.toLowerCase() ) 
!== 0 ) {
+                       return destination;
                }
 
                if ( method === 'all' ) {
-                       return destination.substr( 0, source.length );
+                       return source.substr( 0, destination.length );
                } else if ( method === 'first' ) {
-                       return destination.substr( 0, 1 ) + source.substr( 1 );
+                       return source.substr( 0, 1 ) + destination.substr( 1 );
                } else {
-                       return source;
+                       return destination;
                }
        };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09e8a84490380f317af9f80678083b2c739701ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to