Merge "Remove deprecated jquery.mwExtension module"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 18 Aug 2017 19:43:52 +0000 (19:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 18 Aug 2017 19:43:52 +0000 (19:43 +0000)
RELEASE-NOTES-1.30
resources/Resources.php
resources/src/jquery/jquery.mwExtension.js [deleted file]
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js [deleted file]

index 9474f21..1ab6469 100644 (file)
@@ -168,6 +168,7 @@ changes to languages because of Phabricator reports.
 * WikiImporter now requires the second parameter to be an instance of the Config,
   class. Prior to that, the Config parameter was optional (a behavior deprecated in
   1.25).
+* Removed 'jquery.mwExtension' module. (deprecated since 1.26)
 
 == Compatibility ==
 MediaWiki 1.30 requires PHP 5.5.9 or later. There is experimental support for
index 09bd4dc..5aa166d 100644 (file)
@@ -301,10 +301,6 @@ return [
                'scripts' => 'resources/src/jquery/jquery.mw-jump.js',
                'targets' => [ 'desktop', 'mobile' ],
        ],
-       'jquery.mwExtension' => [
-               'scripts' => 'resources/src/jquery/jquery.mwExtension.js',
-               'targets' => [ 'desktop', 'mobile' ],
-       ],
        'jquery.placeholder' => [
                'deprecated' => 'Use of "jquery.placeholder" is deprecated since MediaWiki 1.29.0',
 
diff --git a/resources/src/jquery/jquery.mwExtension.js b/resources/src/jquery/jquery.mwExtension.js
deleted file mode 100644 (file)
index 9d970ed..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * JavaScript backwards-compatibility alternatives and other convenience functions
- *
- * @deprecated since 1.26 Dated collection of miscellaneous utilities. Methods are
- *  either trivially inline, obsolete, or have a better place elsewhere.
- */
-( function ( $, mw ) {
-       $.each( {
-               trimLeft: function ( str ) {
-                       return str === null ? '' : str.toString().replace( /^\s+/, '' );
-               },
-               trimRight: function ( str ) {
-                       return str === null ?
-                               '' : str.toString().replace( /\s+$/, '' );
-               },
-               ucFirst: function ( str ) {
-                       return str.charAt( 0 ).toUpperCase() + str.slice( 1 );
-               },
-               isDomElement: function ( el ) {
-                       return !!el && !!el.nodeType;
-               },
-               isEmpty: function ( v ) {
-                       var key;
-                       if (
-                               v === '' || v === 0 || v === '0' || v === null || v === false || v === undefined
-                       ) {
-                               return true;
-                       }
-                       // the for-loop could potentially contain prototypes
-                       // to avoid that we check its length first
-                       if ( v.length === 0 ) {
-                               return true;
-                       }
-                       if ( typeof v === 'object' ) {
-                               for ( key in v ) {
-                                       return false;
-                               }
-                               return true;
-                       }
-                       return false;
-               },
-               compareArray: function ( arrThis, arrAgainst ) {
-                       var i;
-                       if ( arrThis.length !== arrAgainst.length ) {
-                               return false;
-                       }
-                       for ( i = 0; i < arrThis.length; i++ ) {
-                               if ( Array.isArray( arrThis[ i ] ) ) {
-                                       if ( !$.compareArray( arrThis[ i ], arrAgainst[ i ] ) ) {
-                                               return false;
-                                       }
-                               } else if ( arrThis[ i ] !== arrAgainst[ i ] ) {
-                                       return false;
-                               }
-                       }
-                       return true;
-               },
-               compareObject: function ( objectA, objectB ) {
-                       var prop, type;
-
-                       // Do a simple check if the types match
-                       if ( typeof objectA === typeof objectB ) {
-
-                               // Only loop over the contents if it really is an object
-                               if ( typeof objectA === 'object' ) {
-                                       // If they are aliases of the same object (ie. mw and mediaWiki) return now
-                                       if ( objectA === objectB ) {
-                                               return true;
-                                       } else {
-                                               // Iterate over each property
-                                               for ( prop in objectA ) {
-                                                       // Check if this property is also present in the other object
-                                                       if ( prop in objectB ) {
-                                                               // Compare the types of the properties
-                                                               type = typeof objectA[ prop ];
-                                                               if ( type === typeof objectB[ prop ] ) {
-                                                                       // Recursively check objects inside this one
-                                                                       switch ( type ) {
-                                                                               case 'object' :
-                                                                                       if ( !$.compareObject( objectA[ prop ], objectB[ prop ] ) ) {
-                                                                                               return false;
-                                                                                       }
-                                                                                       break;
-                                                                               case 'function' :
-                                                                                       // Functions need to be strings to compare them properly
-                                                                                       if ( objectA[ prop ].toString() !== objectB[ prop ].toString() ) {
-                                                                                               return false;
-                                                                                       }
-                                                                                       break;
-                                                                               default:
-                                                                                       // Strings, numbers
-                                                                                       if ( objectA[ prop ] !== objectB[ prop ] ) {
-                                                                                               return false;
-                                                                                       }
-                                                                                       break;
-                                                                       }
-                                                               } else {
-                                                                       return false;
-                                                               }
-                                                       } else {
-                                                               return false;
-                                                       }
-                                               }
-                                               // Check for properties in B but not in A
-                                               // This is about 15% faster (tested in Safari 5 and Firefox 3.6)
-                                               // ...than incrementing a count variable in the above and below loops
-                                               // See also: https://www.mediawiki.org/wiki/ResourceLoader/Default_modules/compareObject_test#Results
-                                               for ( prop in objectB ) {
-                                                       if ( !( prop in objectA ) ) {
-                                                               return false;
-                                                       }
-                                               }
-                                       }
-                               }
-                       } else {
-                               return false;
-                       }
-                       return true;
-               }
-       }, function ( key, value ) {
-               mw.log.deprecate( $, key, value, null, '$.' + key );
-       } );
-
-       mw.log.deprecate( $, 'escapeRE', function ( str ) {
-               return str.replace( /([\\{}()|.?*+\-^$\[\]])/g, '\\$1' ); // eslint-disable-line no-useless-escape
-       }, 'Use mediawiki.RegExp instead.', '$.escapeRE' );
-
-}( jQuery, mediaWiki ) );
index ee3cd5b..7367560 100644 (file)
@@ -56,7 +56,6 @@ return [
                        'tests/qunit/suites/resources/jquery/jquery.highlightText.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.localize.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.makeCollapsible.test.js',
-                       'tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.tabIndex.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.tablesorter.parsers.test.js',
@@ -112,7 +111,6 @@ return [
                        'jquery.highlightText',
                        'jquery.localize',
                        'jquery.makeCollapsible',
-                       'jquery.mwExtension',
                        'jquery.tabIndex',
                        'jquery.tablesorter',
                        'jquery.textSelection',
diff --git a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js
deleted file mode 100644 (file)
index aeda516..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-( function ( $ ) {
-       QUnit.module( 'jquery.mwExtension', QUnit.newMwEnvironment( {
-               // This entire module is deprecated.
-               // Surpress deprecation warnings in test output.
-               setup: function () {
-                       this.suppressWarnings();
-               },
-               teardown: function () {
-                       this.restoreWarnings();
-               }
-       } ) );
-
-       QUnit.test( 'String functions', function ( assert ) {
-               assert.equal( $.trimLeft( '  foo bar  ' ), 'foo bar  ', 'trimLeft' );
-               assert.equal( $.trimRight( '  foo bar  ' ), '  foo bar', 'trimRight' );
-               assert.equal( $.ucFirst( 'foo' ), 'Foo', 'ucFirst' );
-
-               assert.equal( $.escapeRE( '<!-- ([{+mW+}]) $^|?>' ),
-                       '<!\\-\\- \\(\\[\\{\\+mW\\+\\}\\]\\) \\$\\^\\|\\?>', 'escapeRE - Escape specials' );
-               assert.equal( $.escapeRE( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ),
-                       'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'escapeRE - Leave uppercase alone' );
-               assert.equal( $.escapeRE( 'abcdefghijklmnopqrstuvwxyz' ),
-                       'abcdefghijklmnopqrstuvwxyz', 'escapeRE - Leave lowercase alone' );
-               assert.equal( $.escapeRE( '0123456789' ), '0123456789', 'escapeRE - Leave numbers alone' );
-       } );
-
-       QUnit.test( 'isDomElement', function ( assert ) {
-               assert.strictEqual( $.isDomElement( document.createElement( 'div' ) ), true,
-                       'isDomElement: HTMLElement' );
-               assert.strictEqual( $.isDomElement( document.createTextNode( '' ) ), true,
-                       'isDomElement: TextNode' );
-               assert.strictEqual( $.isDomElement( null ), false,
-                       'isDomElement: null' );
-               assert.strictEqual( $.isDomElement( document.getElementsByTagName( 'div' ) ), false,
-                       'isDomElement: NodeList' );
-               assert.strictEqual( $.isDomElement( $( 'div' ) ), false,
-                       'isDomElement: jQuery' );
-               assert.strictEqual( $.isDomElement( { foo: 1 } ), false,
-                       'isDomElement: Plain Object' );
-       } );
-
-       QUnit.test( 'isEmpty', function ( assert ) {
-               assert.strictEqual( $.isEmpty( 'string' ), false, 'isEmpty: "string"' );
-               assert.strictEqual( $.isEmpty( '0' ), true, 'isEmpty: "0"' );
-               assert.strictEqual( $.isEmpty( '' ), true, 'isEmpty: ""' );
-               assert.strictEqual( $.isEmpty( 1 ), false, 'isEmpty: 1' );
-               assert.strictEqual( $.isEmpty( [] ), true, 'isEmpty: []' );
-               assert.strictEqual( $.isEmpty( {} ), true, 'isEmpty: {}' );
-
-               // Documented behavior
-               assert.strictEqual( $.isEmpty( { length: 0 } ), true, 'isEmpty: { length: 0 }' );
-       } );
-
-       QUnit.test( 'Comparison functions', function ( assert ) {
-               assert.ok( $.compareArray( [ 0, 'a', [], [ 2, 'b' ] ], [ 0, 'a', [], [ 2, 'b' ] ] ),
-                       'compareArray: Two deep arrays that are excactly the same' );
-               assert.ok( !$.compareArray( [ 1 ], [ 2 ] ), 'compareArray: Two different arrays (false)' );
-
-               assert.ok( $.compareObject( {}, {} ), 'compareObject: Two empty objects' );
-               assert.ok( $.compareObject( { foo: 1 }, { foo: 1 } ), 'compareObject: Two the same objects' );
-               assert.ok( !$.compareObject( { bar: true }, { baz: false } ),
-                       'compareObject: Two different objects (false)' );
-       } );
-}( jQuery ) );