* Deprecated since MediaWiki 1.26.
* Not used anywhere in Wikimedia Git.
* Grafana mw-js-deprecate dashboard shows < 1 hit per day on average
for any of the jquery.mwExtension properties, during the past 3 weeks.
Most days 0, some days 18 individual hits.
By comparison, legacy wikibits before we removed it in May 2017 was down
to about 6,000/24h (combined), so removal is quite overdue.
Change-Id: Ib66d1844b4fb8d7185b0e6607b9f98c1be632bb5
* 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
'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',
+++ /dev/null
-/*
- * 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 ) );
'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',
'jquery.highlightText',
'jquery.localize',
'jquery.makeCollapsible',
- 'jquery.mwExtension',
'jquery.tabIndex',
'jquery.tablesorter',
'jquery.textSelection',
+++ /dev/null
-( 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 ) );