resources: Rename a few local 'filterFn' vars to 'filterFunction'
[lhc/web/wiklou.git] / resources / src / jquery / jquery.lengthLimit.js
index 26f8f9b..0e3394b 100644 (file)
@@ -31,7 +31,7 @@
         * function, if none, pass empty string.
         * @param {string} newVal New value that may have to be trimmed down.
         * @param {number} byteLimit Number of bytes the value may be in size.
-        * @param {Function} [filterFn] See jQuery#byteLimit.
+        * @param {Function} [filterFunction] See jQuery#byteLimit.
         * @return {Object}
         * @return {string} return.newVal
         * @return {boolean} return.trimmed
        mw.log.deprecate( $, 'trimByteLength', trimByteLength,
                'Use require( \'mediawiki.String\' ).trimByteLength instead.', '$.trimByteLength' );
 
-       function lengthLimit( trimFn, limit, filterFn ) {
+       function lengthLimit( trimFn, limit, filterFunction ) {
                var allowNativeMaxlength = trimFn === trimByteLength;
 
                // If the first argument is the function,
-               // set filterFn to the first argument's value and ignore the second argument.
+               // set filterFunction to the first argument's value and ignore the second argument.
                if ( typeof limit === 'function' ) {
-                       filterFn = limit;
+                       filterFunction = limit;
                        limit = undefined;
                // Either way, verify it is a function so we don't have to call
                // isFunction again after this.
-               } else if ( !filterFn || typeof filterFn !== 'function' ) {
-                       filterFn = undefined;
+               } else if ( !filterFunction || typeof filterFunction !== 'function' ) {
+                       filterFunction = undefined;
                }
 
                // The following is specific to each element in the collection.
                                return;
                        }
 
-                       if ( filterFn ) {
+                       if ( filterFunction ) {
                                // Save function for reference
-                               $el.data( 'lengthLimit.callback', filterFn );
+                               $el.data( 'lengthLimit.callback', filterFunction );
                        }
 
                        // Remove old event handlers (if there are any)
                        $el.off( '.lengthLimit' );
 
-                       if ( filterFn || !allowNativeMaxlength ) {
+                       if ( filterFunction || !allowNativeMaxlength ) {
                                // Disable the native maxLength (if there is any), because it interferes
                                // with the (differently calculated) character/byte limit.
                                // Aside from being differently calculated,
                                        prevSafeVal,
                                        this.value,
                                        elLimit,
-                                       filterFn
+                                       filterFunction
                                );
 
                                // Only set value property if it was trimmed, because whenever the
         *
         * @param {number} [limit] Limit to enforce, fallsback to maxLength-attribute,
         *  called with fetched value as argument.
-        * @param {Function} [filterFn] Function to call on the string before assessing the length.
+        * @param {Function} [filterFunction] Function to call on the string before assessing the length.
         * @return {jQuery}
         * @chainable
         */
-       $.fn.byteLimit = function ( limit, filterFn ) {
-               return lengthLimit.call( this, trimByteLength, limit, filterFn );
+       $.fn.byteLimit = function ( limit, filterFunction ) {
+               return lengthLimit.call( this, trimByteLength, limit, filterFunction );
        };
 
        /**
         *
         * @param {number} [limit] Limit to enforce, fallsback to maxLength-attribute,
         *  called with fetched value as argument.
-        * @param {Function} [filterFn] Function to call on the string before assessing the length.
+        * @param {Function} [filterFunction] Function to call on the string before assessing the length.
         * @return {jQuery}
         * @chainable
         */
-       $.fn.codePointLimit = function ( limit, filterFn ) {
-               return lengthLimit.call( this, trimCodePointLength, limit, filterFn );
+       $.fn.codePointLimit = function ( limit, filterFunction ) {
+               return lengthLimit.call( this, trimCodePointLength, limit, filterFunction );
        };
 
        /**